code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "theme/css"
sass_dir = "theme/scss"
images_dir = "images"
javascripts_dir = "js"
# You can select your preferred output style here (can be overridden via the command line):
output_style = :co... | Ruby |
def validations
valid = ARGV.extract_inputs.all? do |argument|
argument =~ /\d+/ # any of the argument is not a number
end
unless valid
$stderr.puts 'input is invalid'
exit
end
end
class Array
def extract_inputs
reject { |input| input =~ /^--/ }
end
end
def debug?
ARGV.include?('--debug... | Ruby |
#!/usr/bin/env ruby
require 'pp'
require 'common'
=begin
insertion sort
for i in 2..n
input = inputs[i]
while i > 1 && inputs[i-1] > input
inputs[i] = inputs[i-1]
i--
inputs[i] = input
=end
# main program
validations
inputs = ARGV.extract_inputs.map(& :to_i)
(1...inputs.length).each do |i|
input =... | Ruby |
#!/usr/bin/env ruby
require 'pp'
require 'common'
=begin
find the minimum number and place it at the beginning, do same for the rest
for i in 1..n
champion = i
for j in i+1..n
challenger = j
if A[challenger] < A[champion]
champion = challenger
A[champion] <=> A[i] //swap A[champion] and A[i]
=end
... | Ruby |
#!/usr/bin/env ruby
require 'pp'
require 'common'
=begin
mergesort(A, j, k)
if k = 1
return
m = k/2
n = k - k/2
mergesort(A, j, m)
mergesort(A, j + m + 1, n)
merge(A, j, m, n)
merge(A, j, m, n)
K = A[j..j+m]
L = A[j+m+1..j+n]
x = 1
y = 1
for i in j..j+m+n-1
if y > n || x <= m && K[x] ... | Ruby |
$debug = false
#interpolation type
NEAREST_NEIGHBOR = 1
BILINEAR = 2
#=begin
m = [ 8, 6, 13, 9,
1,13,1, 15,
5, 4, 7,7,
5,10,3, 7]
#=end
=begin
m = [64, 2, 3,61,60, 6, 7,57,
9,55,54,12,13,51,50,18,
17,47,46,20,21,43,42,24,
40,26,27,37,36,30,31,33,
32,34,35,29,28,38,39,25,
41,23,22,44,45,1... | Ruby |
#!/usr/bin/env ruby
require 'json'
RESET_PROB = 0.15;
class Handler
def gather_edges(json)
{:edges => :IN_EDGES}
end
def scatter_edges(json)
last_change = json['state'].to_f
return {:edges => :OUT_EDGES} if last_change > 1e-2
return {:edges => :NO_EDGES}
end
def gather(json)
edge = j... | Ruby |
#!/usr/bin/env ruby
require 'json'
INFINITY = 1e99
class String
alias :old_to_f :to_f
def to_f
return INFINITY if 0 >= self.length
self.old_to_f
end
end
class Handler
def gather_edges(json)
{:edges => :IN_EDGES}
end
def scatter_edges(json)
{:edges => :OUT_EDGES}
end
def gather(jso... | Ruby |
#!/usr/bin/env ruby
def colorize(text, color_code)
"\e[0;#{color_code}m#{text}\e[0m"
end
def red(text)
colorize(text, 31)
end
def green(text)
colorize(text, 32)
end
def cyan(text)
colorize(text, 36)
end
begin
# open new terminal
fd = IO.sysopen("/dev/tty", "r")
term = IO.new(fd,"r")
thread = T... | Ruby |
# Copyright (C) 2010 Tom Verbeure
#
# 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 wri... | Ruby |
#! /usr/bin/env ruby
# Copyright (C) 2010 Tom Verbeure
#
# 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 l... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
# A script to help finding performance bottlenecks:
#
# $ ruby-prof myscript.rb
# => String#+ gets called 50k times and takes 30s
#
# $ LOGCA... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
#
# shows the preprocessor path to find a specific line
# usage: ruby chdr-find.rb 'regex pattern' list of files.h
#
def gets
l = $ungets
$... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
#
# parses the PPC specification PDF to generate the opcode list
#
require 'pdfparse'
$field_mask = {}
$field_shift = {}
$opcodes = []
def ma... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
# this file loads all metasm files, to avoid using ruby autoload mechanism
require File.join(File.dirname(__FILE__), '..', 'metasm')
module ... | Ruby |
#!/usr/bin/env ruby
# encoding: binary (rage)
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
# This scripts is used to compile the Metasm documentation into html files
# Losely inspired fro... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
# searches an object in the attributes of another
# anyobj.scan_for([obj]) => "anyobj.someattr[42]['blabla']"
class Object
def scan_iter
... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
#
# parses a PDF file
# used by ppc_pdf2oplist
#
require 'zlib'
# a Virtual string backed by a file, which is read on-demand
class VString
... | Ruby |
#!/usr/bin/env ruby
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
synclen = 6
ctxlen = 16
file1 = ('x'*ctxlen) + File.read(ARGV.shift)
file2 = ('x'*ctxlen) + File.read(ARGV.shift)
coun... | Ruby |
#!/usr/bin/ruby
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
# this is a TCP proxy which dumps the transmitted data in hex on stdout
# usage: tcp_proxy <lhost> <lport> <rhost> <rport> [<... | Ruby |
#!/usr/bin/ruby
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
# this is a ruby code cleaner tool
# it passes its argument to ruby -v -c, which displays warnings (eg unused variable)
# it ... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
# computes the difference beetween two ruby objects
# walks accessors, arrays and hashes
def Object.diff(o1, o2)
if o1.class == o2.class
... | Ruby |
#!/usr/bin/env ruby
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
class IO
def hexdump(ctx={})
ctx[:noend] = true
while buf = read(512) and not buf.empty?
buf.hexdump(ctx)
end
ctx.... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/x86_64/parse'
require 'metasm/compile_c'
module Metasm
class X86_64
class CCompiler < C::Compiler
# holds compiler stat... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/x86_64/opcodes'
require 'metasm/render'
module Metasm
class X86_64
def gui_hilight_word_regexp_init
ret = {}
%w[a ... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/x86_64/opcodes'
module Metasm
class X86_64
def dbg_register_pc
@dbg_register_pc ||= :rip
end
def dbg_register_flags... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/x86_64/opcodes'
require 'metasm/decode'
module Metasm
class X86_64
class ModRM
def self.decode(edata, byte, endiannes... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/x86_64/opcodes'
require 'metasm/encode'
module Metasm
class X86_64
class ModRM
def self.encode_reg(reg, mregval = 0)
... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/x86_64/main'
require 'metasm/cpu/ia32/opcodes'
module Metasm
class X86_64
def init_cpu_constants
super()
[:i32, :u3... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/x86_64/opcodes'
require 'metasm/cpu/x86_64/encode'
require 'metasm/parse'
module Metasm
class X86_64
def parse_parser_i... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/main'
require 'metasm/cpu/ia32'
module Metasm
# The x86_64, 64-bit extension of the x86 CPU (x64, em64t, amd64...)
class X8... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/main'
require 'metasm/cpu/cy16/decode'
require 'metasm/cpu/cy16/render'
| Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2010 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/sh4/opcodes'
require 'metasm/decode'
module Metasm
class Sh4
def build_opcode_bin_mask(op)
op.bin_mask = 0
op.args.e... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2010 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/sh4/main'
module Metasm
class Sh4
def addop(name, bin, *args)
o = Opcode.new name, bin
args.each { |a|
o.args <<... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2010 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/main'
module Metasm
class Sh4 < CPU
def initialize(e = :little, transfersz = 0, fpprecision = 0)
super()
@endianness = ... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/mips/parse'
require 'metasm/compile_c'
| Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/mips/opcodes'
require 'metasm/render'
module Metasm
class MIPS
class Reg
include Renderable
def render ; [self.clas... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/main'
module Metasm
class MIPS
def dbg_register_pc
@dbg_register_pc ||= :pc
end
def dbg_register_flags
@dbg_register_... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/mips/opcodes'
require 'metasm/decode'
module Metasm
class MIPS
def build_opcode_bin_mask(op)
# bit = 0 if can be muta... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/mips/opcodes'
require 'metasm/encode'
module Metasm
class MIPS
private
def encode_instr_op(exe, instr, op)
base = op... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/mips/main'
# TODO coprocessors, floating point, 64bits, thumb mode
module Metasm
class MIPS
def addop(name, bin, *arg... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/mips/opcodes'
require 'metasm/parse'
module Metasm
class MIPS
def parse_arg_valid?(op, sym, arg)
# special case for l... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/main'
module Metasm
class MIPS < CPU
class Reg
class << self
attr_accessor :s_to_i, :i_to_s
end
@s_to_i = {}
@i_... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
class Metasm::Dalvik < Metasm::CPU
end
require 'metasm/main'
require 'metasm/cpu/dalvik/decode'
| Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/render'
require 'metasm/cpu/arm/opcodes'
module Metasm
class ARM
class Reg
include Renderable
def render
r = self.cla... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/arm/opcodes'
module Metasm
class ARM
def dbg_register_pc
@dbg_register_pc ||= :pc
end
def dbg_register_flags
@dbg... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/arm/opcodes'
require 'metasm/decode'
module Metasm
class ARM
# create the bin_mask for a given opcode
def build_opcode_... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/arm/opcodes'
require 'metasm/encode'
module Metasm
class ARM
def encode_instr_op(program, instr, op)
base = op.bin
... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/arm/main'
module Metasm
class ARM
private
# ARM MODE
def addop(name, bin, *args)
args << :cond if not args.delete... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/arm/opcodes'
require 'metasm/parse'
module Metasm
class ARM
def opcode_list_byname
@opcode_list_byname ||= opcode_lis... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/main'
module Metasm
class ARM < CPU
class Reg
class << self
attr_accessor :s_to_i, :i_to_s
end
@i_to_s = %w[r0 r1 ... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
class Metasm::MIPS < Metasm::CPU
end
require 'metasm/main'
require 'metasm/cpu/mips/parse'
require 'metasm/cpu/mips/encode'
require 'metasm/c... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
class Metasm::ARM < Metasm::CPU
end
require 'metasm/main'
require 'metasm/cpu/arm/parse'
require 'metasm/cpu/arm/encode'
require 'metasm/cpu/... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
class Metasm::X86_64 < Metasm::Ia32
end
require 'metasm/main'
require 'metasm/cpu/x86_64/parse'
require 'metasm/cpu/x86_64/encode'
require 'm... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2010 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/python/opcodes'
require 'metasm/decode'
module Metasm
class Python
def build_bin_lookaside
opcode_list.inject({}) { |l... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2010 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/python/main'
module Metasm
class Python
CMP_OP = %w[< <= == != > >= in not_in is is_not exch]
def addop(name, bin, *ar... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2010 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/main'
module Metasm
class Python < CPU
def initialize(prog = nil)
super()
@program = prog
@endianness = (prog.respond_... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/main'
require 'metasm/cpu/z80/decode'
require 'metasm/cpu/z80/render'
| Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2010 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/main'
require 'metasm/cpu/arc/decode'
| Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2010 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/main'
require 'metasm/cpu/python/decode'
| Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/main'
require 'metasm/cpu/ppc/parse'
require 'metasm/cpu/ppc/encode'
require 'metasm/cpu/ppc/decode'
require 'metasm/cpu/ppc/... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/cy16/opcodes'
require 'metasm/render'
module Metasm
class CY16
class Reg
include Renderable
def render ; [self.clas... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/cy16/opcodes'
require 'metasm/decode'
module Metasm
class CY16
def build_opcode_bin_mask(op)
# bit = 0 if can be muta... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/cy16/main'
module Metasm
class CY16
def addop(name, bin, *args)
o = Opcode.new name, bin
args.each { |a|
o.args ... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/main'
module Metasm
class CY16 < CPU
class Reg
class << self
attr_accessor :s_to_i, :i_to_s
end
@i_to_s = (0..14).... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/z80/opcodes'
require 'metasm/render'
module Metasm
class Z80
class Reg
include Renderable
def render ; [self.class.... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/z80/opcodes'
require 'metasm/decode'
module Metasm
class Z80
def build_opcode_bin_mask(op)
# bit = 0 if can be mutate... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/z80/main'
module Metasm
class Z80
def addop(name, bin, *args)
o = Opcode.new name, bin
args.each { |a|
o.args <<... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/main'
module Metasm
class Z80 < CPU
class Reg
class << self
attr_accessor :s_to_i, :i_to_s
end
@i_to_s = { 8 => { ... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/pic16c/opcodes'
require 'metasm/decode'
module Metasm
class Pic16c
def build_opcode_bin_mask(op)
# bit = 0 if can be ... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/pic16c/main'
module Metasm
class Pic16c
def addop(name, bin, *l)
o = Opcode.new name, bin
l.each { |ll|
if @prop... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/main'
module Metasm
class Pic16c < CPU
def initialize(endianness = :big)
super()
@endianness = endianness
init
end
e... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2010 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/arc/opcodes'
require 'metasm/decode'
module Metasm
class ARC
def major_opcode(val, sz = 16)
return val >> (sz == 16 ? ... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2010 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/arc/main'
module Metasm
class ARC
def addop32(name, bin, *args)
addop(:ac32, name, bin, *args)
end
def addop16(name... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2010 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/main'
module Metasm
class ARC < CPU
def initialize(e = :little)
super()
@endianness = e
@size = 32
end
class Reg
... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/ppc/main'
module Metasm
class PowerPC
# temporarily setup dasm.address_binding so that backtracking
# stack-related of... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/ppc/opcodes'
require 'metasm/decode'
module Metasm
class PowerPC
def build_opcode_bin_mask(op)
# bit = 0 if can be mu... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/ppc/opcodes'
require 'metasm/encode'
module Metasm
class PowerPC
private
def encode_instr_op(exe, instr, op)
base = ... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/ppc/main'
module Metasm
class PowerPC
def addop(name, bin, *argprops)
o = Opcode.new name, bin
argprops.each { |a|... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/ppc/opcodes'
require 'metasm/parse'
module Metasm
class PowerPC
# TODO
def parse_arg_valid?(op, sym, arg)
# special c... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/main'
require 'metasm/render'
module Metasm
class PowerPC < CPU
class Reg
include Renderable
def ==(o)
o.class == s... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/ia32/main'
module Metasm
class Ia32
# temporarily setup dasm.address_binding so that backtracking
# stack-related offs... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/ia32/parse'
require 'metasm/compile_c'
module Metasm
class Ia32
class CCompiler < C::Compiler
# holds compiler state in... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/ia32/opcodes'
require 'metasm/render'
# XXX move context in another file ?
module Metasm
class Ia32
class Argument
in... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/ia32/opcodes'
module Metasm
class Ia32
def dbg_register_pc
@dbg_register_pc ||= :eip
end
def dbg_register_sp
@dbg... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/ia32/opcodes'
require 'metasm/decode'
module Metasm
class Ia32
class ModRM
def self.decode(edata, byte, endianness, a... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/ia32/opcodes'
require 'metasm/encode'
module Metasm
class Ia32
class InvalidModRM < Exception ; end
class ModRM
# re... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/ia32/main'
module Metasm
class Ia32
def init_cpu_constants
@opcode_list ||= []
@fields_mask.update :w => 1, :s => 1... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/ia32/opcodes'
require 'metasm/cpu/ia32/encode'
require 'metasm/parse'
module Metasm
class Ia32
class ModRM
# may return... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/main'
module Metasm
# The ia32 aka x86 CPU
# currently limited to 16 and 32bit modes
class Ia32 < CPU
# some ruby magic t... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
# fix autorequire warning
class Metasm::Ia32 < Metasm::CPU
end
require 'metasm/main'
require 'metasm/cpu/ia32/parse'
require 'metasm/cpu/ia32... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/main'
require 'metasm/cpu/sh4/decode'
| Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/cpu/dalvik/opcodes'
require 'metasm/decode'
module Metasm
class Dalvik
def build_bin_lookaside
end
def decode_findopcode(... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
# the Dalvik binary format, aka android java backend bytecode
# this file was generated using the android source tree, as reference,
# specifi... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/main'
module Metasm
class Dalvik < CPU
class Reg
attr_accessor :i
def initialize(i)
@i = i
end
def symbolic
... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/main'
require 'metasm/decode'
require 'metasm/parse_c'
module Metasm
class C::Variable; attr_accessor :stackoff; end
class C... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/main'
require 'metasm/parse_c'
module Metasm
module C
class Parser
def precompile
@toplevel.precompile(Compiler.new(se... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/main'
module Metasm
# a Renderable element has a method #render that returns an array of [String or Renderable]
module Rend... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
# this file compliments disassemble.rb, adding misc user-friendly methods
module Metasm
class InstructionBlock
# adds an address to the from... | Ruby |
# This file is part of Metasm, the Ruby assembly manipulation suite
# Copyright (C) 2006-2009 Yoann GUILLOT
#
# Licence is LGPL, see LICENCE in the top-level directory
module Metasm
# this class implements a high-level debugging API (abstract superclass)
class Debugger
class Breakpoint
attr_accessor :addre... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.