orgasm 0.0.1a2 → 0.0.1a3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/{disorgasm → ejaculate} +0 -0
- data/bin/swallow +0 -0
- data/lib/orgasm.rb +8 -2
- data/lib/orgasm/arch/i386.rb +27 -0
- data/lib/orgasm/{style.rb → arch/i386/base.rb} +4 -0
- data/lib/orgasm/{common → arch/i386/base}/address.rb +12 -19
- data/lib/orgasm/{common/unknown.rb → arch/i386/base/immediate.rb} +6 -10
- data/lib/orgasm/arch/i386/base/instruction.rb +41 -0
- data/lib/orgasm/arch/i386/base/register.rb +40 -0
- data/lib/orgasm/arch/i386/disassembler.rb +26 -154
- data/lib/orgasm/arch/i386/generator.rb +44 -0
- data/lib/orgasm/arch/i386/instructions.rb +150 -0
- data/lib/orgasm/arch/i386/instructions/dsl.rb +159 -0
- data/lib/orgasm/arch/i386/instructions/dsl/special.rb +75 -0
- data/lib/orgasm/arch/i386/instructions/instructions.rb +50 -0
- data/lib/orgasm/arch/i386/styles.rb +70 -0
- data/lib/orgasm/architecture.rb +103 -0
- data/lib/orgasm/assembler.rb +5 -16
- data/lib/orgasm/base.rb +50 -0
- data/lib/orgasm/{common/constant.rb → base/address.rb} +7 -6
- data/lib/orgasm/{common/register.rb → base/constant.rb} +11 -8
- data/lib/orgasm/base/instruction.rb +41 -0
- data/lib/orgasm/{common/instruction.rb → base/register.rb} +8 -8
- data/lib/orgasm/base/unknown.rb +36 -0
- data/lib/orgasm/disassembler.rb +25 -22
- data/lib/orgasm/disassembler/decoder.rb +26 -20
- data/lib/orgasm/{common/extensions.rb → extensions.rb} +12 -0
- data/lib/orgasm/generator.rb +46 -0
- data/lib/orgasm/generator/dsl.rb +60 -0
- data/lib/orgasm/piece.rb +49 -0
- data/lib/orgasm/styles.rb +64 -0
- data/lib/orgasm/styles/style.rb +55 -0
- data/lib/orgasm/version.rb +1 -1
- metadata +54 -14
- data/lib/orgasm/common.rb +0 -36
@@ -0,0 +1,60 @@
|
|
1
|
+
#--
|
2
|
+
# Copyleft meh. [http://meh.paranoid.pk | meh@paranoici.org]
|
3
|
+
#
|
4
|
+
# This file is part of orgasm.
|
5
|
+
#
|
6
|
+
# orgasm is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU Affero General Public License as published
|
8
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# orgasm is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU Affero General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Affero General Public License
|
17
|
+
# along with orgasm. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
|
20
|
+
module Orgasm; class Generator < Piece
|
21
|
+
|
22
|
+
class DSL < BasicObject
|
23
|
+
def initialize (&block)
|
24
|
+
@block = block
|
25
|
+
end
|
26
|
+
|
27
|
+
def execute (generator)
|
28
|
+
@generator = generator
|
29
|
+
@instructions = []
|
30
|
+
|
31
|
+
instance_eval &@block
|
32
|
+
|
33
|
+
@instructions
|
34
|
+
end
|
35
|
+
|
36
|
+
def method_missing (id, *args, &block)
|
37
|
+
if @generator.respond_to? id
|
38
|
+
return @generator.__send__ id, *args, &block
|
39
|
+
end
|
40
|
+
|
41
|
+
@instructions << if @generator.respond_to? :callback
|
42
|
+
@generator.callback id, *args, &block
|
43
|
+
else
|
44
|
+
@generator.for(::Orgasm::Instruction).call(id) {|i|
|
45
|
+
args.each {|arg|
|
46
|
+
i.parameters << case arg
|
47
|
+
when ::Symbol then @generator.for(::Orgasm::Register).call(arg)
|
48
|
+
when ::Array then @generator.for(::Orgasm::Address).call(arg)
|
49
|
+
when ::Integer then
|
50
|
+
if arg.frozen? then @generator.for(::Orgasm::Constant).call(arg)
|
51
|
+
else @generator.for(::Orgasm::Address).call(arg)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
}
|
55
|
+
}
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
end; end
|
data/lib/orgasm/piece.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
#--
|
2
|
+
# Copyleft meh. [http://meh.paranoid.pk | meh@paranoici.org]
|
3
|
+
#
|
4
|
+
# This file is part of orgasm.
|
5
|
+
#
|
6
|
+
# orgasm is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU Affero General Public License as published
|
8
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# orgasm is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU Affero General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Affero General Public License
|
17
|
+
# along with orgasm. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
|
20
|
+
module Orgasm
|
21
|
+
|
22
|
+
class Piece
|
23
|
+
attr_reader :arch
|
24
|
+
|
25
|
+
def initialize (arch, io=nil, &block)
|
26
|
+
@arch = arch
|
27
|
+
|
28
|
+
instance_eval io.read if io
|
29
|
+
instance_eval &block if block
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.inherited (subclass)
|
33
|
+
subclass.class_eval {
|
34
|
+
define_method subclass.name[/([^:]+)$/].downcase do
|
35
|
+
self
|
36
|
+
end
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
def method_missing (id, *args, &block)
|
41
|
+
if @arch.respond_to? id
|
42
|
+
@arch.__send__ id, *args, &block
|
43
|
+
else
|
44
|
+
super
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
#--
|
2
|
+
# Copyleft meh. [http://meh.paranoid.pk | meh@paranoici.org]
|
3
|
+
#
|
4
|
+
# This file is part of orgasm.
|
5
|
+
#
|
6
|
+
# orgasm is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU Affero General Public License as published
|
8
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# orgasm is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU Affero General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Affero General Public License
|
17
|
+
# along with orgasm. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
|
20
|
+
require 'orgasm/styles/style'
|
21
|
+
|
22
|
+
module Orgasm
|
23
|
+
|
24
|
+
class Styles < Piece
|
25
|
+
def initialize (*)
|
26
|
+
@styles = []
|
27
|
+
|
28
|
+
super
|
29
|
+
end
|
30
|
+
|
31
|
+
def style (*args, &block)
|
32
|
+
@styles << Style.new(*args, &block)
|
33
|
+
end
|
34
|
+
|
35
|
+
def use (name)
|
36
|
+
@current = @styles.find {|style|
|
37
|
+
style.names.member?(name)
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
def current
|
42
|
+
@current or use(@styles.first.name)
|
43
|
+
end
|
44
|
+
|
45
|
+
def extend (*things)
|
46
|
+
styles = self
|
47
|
+
|
48
|
+
things.flatten.compact.each {|thing|
|
49
|
+
thing.refine_method :to_s do |old, *|
|
50
|
+
begin
|
51
|
+
styles.apply(self) or old.call or inspect
|
52
|
+
rescue
|
53
|
+
old.call or inspect
|
54
|
+
end
|
55
|
+
end
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
def apply (thing)
|
60
|
+
current.apply(thing)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
#--
|
2
|
+
# Copyleft meh. [http://meh.paranoid.pk | meh@paranoici.org]
|
3
|
+
#
|
4
|
+
# This file is part of orgasm.
|
5
|
+
#
|
6
|
+
# orgasm is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU Affero General Public License as published
|
8
|
+
# by the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# orgasm is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU Affero General Public License for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Affero General Public License
|
17
|
+
# along with orgasm. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
|
20
|
+
module Orgasm; class Styles < Piece
|
21
|
+
|
22
|
+
class Style
|
23
|
+
attr_reader :names
|
24
|
+
|
25
|
+
def initialize (*names)
|
26
|
+
@names = names
|
27
|
+
@for = {}
|
28
|
+
|
29
|
+
yield self
|
30
|
+
end
|
31
|
+
|
32
|
+
def for (klass, &block)
|
33
|
+
@for[klass] = block
|
34
|
+
end
|
35
|
+
|
36
|
+
def apply (thing)
|
37
|
+
callback = @for[thing.class] or @for.find {|(what, block)|
|
38
|
+
what.ancestors.member?(thing.class)
|
39
|
+
}.last
|
40
|
+
|
41
|
+
if callback
|
42
|
+
thing.instance_eval &callback
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def name
|
47
|
+
names.first
|
48
|
+
end
|
49
|
+
|
50
|
+
def to_s
|
51
|
+
name
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
end; end
|
data/lib/orgasm/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: orgasm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: 5
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.1a3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- meh.
|
@@ -10,13 +10,35 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-07-
|
14
|
-
dependencies:
|
15
|
-
|
13
|
+
date: 2011-07-21 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: memoized
|
17
|
+
prerelease: false
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
type: :runtime
|
25
|
+
version_requirements: *id001
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: refining
|
28
|
+
prerelease: false
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: "0"
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id002
|
16
37
|
description:
|
17
38
|
email: meh@paranoici.org
|
18
39
|
executables:
|
19
|
-
-
|
40
|
+
- swallow
|
41
|
+
- ejaculate
|
20
42
|
extensions: []
|
21
43
|
|
22
44
|
extra_rdoc_files: []
|
@@ -24,22 +46,40 @@ extra_rdoc_files: []
|
|
24
46
|
files:
|
25
47
|
- lib/orgasm/format/elf.rb
|
26
48
|
- lib/orgasm/format/pe.rb
|
49
|
+
- lib/orgasm/base.rb
|
50
|
+
- lib/orgasm/base/register.rb
|
51
|
+
- lib/orgasm/base/unknown.rb
|
52
|
+
- lib/orgasm/base/address.rb
|
53
|
+
- lib/orgasm/base/constant.rb
|
54
|
+
- lib/orgasm/base/instruction.rb
|
55
|
+
- lib/orgasm/arch/i386.rb
|
56
|
+
- lib/orgasm/arch/i386/base.rb
|
57
|
+
- lib/orgasm/arch/i386/instructions/instructions.rb
|
58
|
+
- lib/orgasm/arch/i386/instructions/dsl/special.rb
|
59
|
+
- lib/orgasm/arch/i386/instructions/dsl.rb
|
60
|
+
- lib/orgasm/arch/i386/base/register.rb
|
61
|
+
- lib/orgasm/arch/i386/base/immediate.rb
|
62
|
+
- lib/orgasm/arch/i386/base/address.rb
|
63
|
+
- lib/orgasm/arch/i386/base/instruction.rb
|
64
|
+
- lib/orgasm/arch/i386/instructions.rb
|
65
|
+
- lib/orgasm/arch/i386/generator.rb
|
66
|
+
- lib/orgasm/arch/i386/styles.rb
|
27
67
|
- lib/orgasm/arch/i386/disassembler.rb
|
68
|
+
- lib/orgasm/generator/dsl.rb
|
28
69
|
- lib/orgasm/assembler.rb
|
70
|
+
- lib/orgasm/extensions.rb
|
29
71
|
- lib/orgasm/version.rb
|
30
|
-
- lib/orgasm/
|
31
|
-
- lib/orgasm/
|
32
|
-
- lib/orgasm/
|
33
|
-
- lib/orgasm/
|
34
|
-
- lib/orgasm/common/constant.rb
|
35
|
-
- lib/orgasm/common/instruction.rb
|
36
|
-
- lib/orgasm/style.rb
|
72
|
+
- lib/orgasm/generator.rb
|
73
|
+
- lib/orgasm/architecture.rb
|
74
|
+
- lib/orgasm/styles.rb
|
75
|
+
- lib/orgasm/styles/style.rb
|
37
76
|
- lib/orgasm/disassembler.rb
|
38
77
|
- lib/orgasm/disassembler/decoder.rb
|
39
78
|
- lib/orgasm/format.rb
|
40
|
-
- lib/orgasm/
|
79
|
+
- lib/orgasm/piece.rb
|
41
80
|
- lib/orgasm.rb
|
42
|
-
- bin/
|
81
|
+
- bin/swallow
|
82
|
+
- bin/ejaculate
|
43
83
|
homepage: http://github.com/meh/orgasm
|
44
84
|
licenses: []
|
45
85
|
|
data/lib/orgasm/common.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Copyleft meh. [http://meh.paranoid.pk | meh@paranoici.org]
|
3
|
-
#
|
4
|
-
# This file is part of orgasm.
|
5
|
-
#
|
6
|
-
# orgasm is free software: you can redistribute it and/or modify
|
7
|
-
# it under the terms of the GNU Affero General Public License as published
|
8
|
-
# by the Free Software Foundation, either version 3 of the License, or
|
9
|
-
# (at your option) any later version.
|
10
|
-
#
|
11
|
-
# orgasm is distributed in the hope that it will be useful,
|
12
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
-
# GNU Affero General Public License for more details.
|
15
|
-
#
|
16
|
-
# You should have received a copy of the GNU Affero General Public License
|
17
|
-
# along with orgasm. If not, see <http://www.gnu.org/licenses/>.
|
18
|
-
#++
|
19
|
-
|
20
|
-
require 'orgasm/common/extensions'
|
21
|
-
|
22
|
-
require 'orgasm/common/unknown'
|
23
|
-
require 'orgasm/common/instruction'
|
24
|
-
require 'orgasm/common/address'
|
25
|
-
require 'orgasm/common/register'
|
26
|
-
require 'orgasm/common/constant'
|
27
|
-
|
28
|
-
module Orgasm
|
29
|
-
|
30
|
-
def self.object? (value)
|
31
|
-
[Unknown, Instruction, Address, Register, Constant].any? {|klass|
|
32
|
-
value.is_a?(klass)
|
33
|
-
} && value
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|