code
stringlengths
1
1.73M
language
stringclasses
1 value
module SimpleFormHelper def titulo(accion, nombre, options = {}) unless options[:header] == false header = options[:header] || "#{accion} #{nombre}" aux = "<span class='titulo_centrado'>" aux << " <h3>#{header}</h3>" unless options[:back_link] == false aux << " <span...
Ruby
module NavigatorHelper # Devuelve un symbol con el nombre del modelo relacionado con el controller actual. def get_model controller.model_name end # Devuelve una instancia con la lista de elementos leidas por el controller actual. def get_list nombre = get_model.to_s.pluralize instance...
Ruby
module ActsAsDynamic::Validations def validates_include(*args) options = args.last.is_a?(Hash) ? args.pop : {} attr_name = args.shift attr_values = args.shift || const_get(attr_name.to_s.pluralize.upcase) real_values = attr_values.first.is_a?(Array) ? attr_values.map(&:last) : attr_values ...
Ruby
class SearchParser def initialize(calif) @calif = calif end def parse(qs) result = {} result[:unqualif] = unqualif(qs) result.merge(calificadores(qs)) end protected def unqualif(str) str.gsub(/\s?[^\s]+:.*/, '') end def calificadores(str) result = {}...
Ruby
module ActsAsDynamic::SuperFind def set_qualifiers(options = {}) @qualifiers = options @sp = SearchParser.new(@qualifiers.keys.reject{|q| q == :unqualif}) end def super_find(qs) find(:all, super_find_options(qs)) end def super_find_options(qs) opts = @sp.parse(qs) fnd_opt...
Ruby
module SimpleTabsHelper require 'grid_helper.rb' def simple_tabs yield lista = ListTabs.new render_tabs(lista) end def render_tabs(lista) rtn = [] rtn << tag_for("tab", procesar(lista, "tab") {|llamada, i| link_for(llamada, i) }) rtn << tag_for("pane", procesar(lista, "pane"...
Ruby
module NavigatorTabs def nav_tabs @nav_rtabs = [] @nav_ltabs = [] @nav_tabs = true yield @nav_tabs = false true end def modo(*args) if block_given? yield if args.include?(session[:modo_tabs]) else session[:modo_tabs] = args.first end end ...
Ruby
module MethodicalDomID def method_missing(meth, *args) if meth.to_s =~ /^id_(.+)?$/ ident = new_record? ? "new" : "id_#{id}" [self.class.name.underscore, $1, ident, args.first].compact.join('_') else super end end end ActiveRecord::Base.send(:include, MethodicalDomID)
Ruby
module ActsAsDynamic module ClassMethods Filter = Struct.new(:name, :label, :conditions, :method, :block) ComboFilter = Struct.new(:name, :options, :block) class DynamicGenerator attr_accessor :filters, :combo_filters, :search_fields, :actions, :buttons def initialize ...
Ruby
module Kernel def multi_send(elemento, *campo) campo.flatten.inject(elemento){|rtn, metodo| rtn && rtn.send(metodo)} end end
Ruby
module ActiveRecord class Errors begin @@default_error_messages = {:inclusion => "es obligatorio", :exclusion => "es campo reservado", :invalid => "no es válido", :confirmation => "no coincide la confirmación", :accepted => "debe ser aceptado", :empty => "no...
Ruby
module ActsAsDynamic module Helpers def assert_list(klass, list, elements) assert_equal elements.size, list.size, list.join(' - ') elements.each do |nombre_elem| array = klass.to_s.pluralize.downcase assert list.include?(send(array, nombre_elem)), list.join(' - ') end ...
Ruby
class RViewTemplate def initialize(view) @view = view end def render(template, assigns) env = Object.new def env.create_method(name, &block) self.class.send(:define_method, name, &block) end bind = env.send(:binding) @view.assigns.each do |key, value| en...
Ruby
class CreateUsers < ActiveRecord::Migration def up create_table :users do |t| t.string :profile_id t.string :email t.string :refresh_token end add_index :users, :profile_id end def down drop_table :users end end
Ruby
# Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Ruby
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'sinatra-activerecord' gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client' group :development do gem 'rake' gem 'sqlite3-ruby' end
Ruby
require 'sinatra.rb' # Sinatra defines #set at the top level as a way to set application configuration set :run, false set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development) require './main' run Sinatra::Application
Ruby
require 'sinatra/activerecord/rake' require './main'
Ruby
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'data_mapper', '~> 1.2' gem 'dm-postgres-adapter' gem 'google-api-client', '>= 0.4.3' group :development do gem 'dm-sqlite-adapter', '~> 1.2' gem 'do_sqlite3', '~> 0.10' end
Ruby
# Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Ruby
# 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
require 'sinatra/activerecord/rake' require './main'
Ruby
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'sinatra-activerecord' gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client' group :development do gem 'rake' gem 'sqlite3-ruby' end
Ruby
class CreateUsers < ActiveRecord::Migration def up create_table :users do |t| t.string :profile_id t.string :email t.string :refresh_token end add_index :users, :profile_id end def down drop_table :users end end
Ruby
# Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Ruby
require 'sinatra.rb' # Sinatra defines #set at the top level as a way to set application configuration set :run, false set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development) require './main' run Sinatra::Application
Ruby
require "rubygems" require "rake" Dir['tasks/**/*.rake'].each { |rake| load rake } task :clean => "objc:clean"
Ruby
require 'yaml' require 'text/format' require 'builder' #task :build_release => [:spec, :features, :changelog] do desc "Builds the release package which can be uploaded" task :build_release => [:changelog] do sh "xcodebuild -configuration Release -target 'Release Package' -arch 'i386 x86_64 ppc' -project 'Time Tracke...
Ruby
task :upload => :appcast desc "uploads the artifacts to google code" task :upload do require 'yaml' yaml = YAML.load_file('ChangeLog.yml') version = yaml.first['version'] file = "build/Release/Time Tracker-#{version}.zip" html_file = "appcast/timetracker-#{version}.html" sh "python tasks/googlecode_upload....
Ruby
require 'rake' require 'rake/testtask' require 'rake/rdoctask' require 'spec/rake/spectask' desc 'Default: run unit tests.' task :default => [:clean_db, :test] desc 'Remove the stale db file' task :clean_db do `rm -f #{File.dirname(__FILE__)}/test/state_machine.sqlite.db` end desc 'Test the acts as state machine p...
Ruby
require File.join(File.dirname(__FILE__), 'lib', 'aasm')
Ruby
require File.join(File.dirname(__FILE__), 'state_transition') module AASM module SupportingClasses class Event attr_reader :name def initialize(name, &block) @name = name.to_sym @transitions = [] instance_eval(&block) if block end def next_states(from) ...
Ruby
module AASM module SupportingClasses class StateFactory def self.create(name, opts={}) @states ||= {} @states[name] ||= State.new(name, opts) end def self.[](name) @states[name] end end end end
Ruby
module AASM module SupportingClasses class State attr_reader :name def initialize(name, opts={}) @name, @opts = name, opts end def entering(record) enteract = @opts[:enter] record.send(:run_transition_action, enteract) if enteract end def entered(reco...
Ruby
module AASM def self.included(base) #:nodoc: base.extend AASM::ClassMethods end module ClassMethods def aasm_initial_state @aasm_initial_state end def aasm_initial_state=(state) @aasm_initial_state = state end alias :initial_state :aasm_initial_state= def state(n...
Ruby
module AASM module SupportingClasses class StateTransition attr_reader :from, :to, :opts def initialize(opts) @from, @to, @guard = opts[:from], opts[:to], opts[:guard] @opts = opts end def guard(obj) # TODO should probably not be using obj @guard ? obj.sen...
Ruby
# 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
# $ext_path: This should be the path of where the ExtJS SDK is installed # Generally this will be in a lib/extjs folder in your applications root # <root>/lib/extjs $ext_path = "../../" # sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder # Generally this will be in a resource...
Ruby
# include the utils rb file which has extra functionality for the ext theme dir = File.dirname(__FILE__) require File.join(dir, 'lib', 'utils.rb') # register ext4 as a compass framework Compass::Frameworks.register 'ext4', dir
Ruby
# $ext_path: This should be the path of where the ExtJS SDK is installed # Generally this will be in a lib/extjs folder in your applications root # <root>/lib/extjs $ext_path = "../../lib/extjs" # sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder # Generally this will be in a...
Ruby
module ExtJS4 module SassExtensions module Functions module Utils def parsebox(list, n) assert_type n, :Number if !n.int? raise ArgumentError.new("List index #{n} must be an integer") elsif n.to_i < 1 raise ArgumentError.new("List index #{n} must...
Ruby
# Copyright 2008-2009 Nokia Siemens Networks Oyj # # 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...
Ruby
#!/usr/bin/env ruby class ExampleRemoteLibrary def count_items_in_directory(path) Dir.entries(path).find_all{|i| not i.match('^\.')}.length end def strings_should_be_equal(str1, str2) puts "Comparing '#{str1}' to '#{str2}'" if str1 != str2 raise RuntimeError, "Given strings are not equal" ...
Ruby
class RubyLibraryExample def get_server_language 'ruby' end # Basic communication def passing end def failing(message) raise message end def logging(message, level='INFO') puts "*#{level}* #{message}" end def returning 'returned string' end # Logging def one_message_w...
Ruby
class CreateUsers < ActiveRecord::Migration def up create_table :users do |t| t.string :profile_id t.string :email t.string :refresh_token end add_index :users, :profile_id end def down drop_table :users end end
Ruby
# Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Ruby
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'sinatra-activerecord' gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client' group :development do gem 'rake' gem 'sqlite3-ruby' end
Ruby
require 'sinatra.rb' # Sinatra defines #set at the top level as a way to set application configuration set :run, false set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development) require './main' run Sinatra::Application
Ruby
require 'sinatra/activerecord/rake' require './main'
Ruby
require 'sinatra/activerecord/rake' require './main'
Ruby
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'sinatra-activerecord' gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client' group :development do gem 'rake' gem 'sqlite3-ruby' end
Ruby
class CreateUsers < ActiveRecord::Migration def up create_table :users do |t| t.string :profile_id t.string :email t.string :refresh_token end add_index :users, :profile_id end def down drop_table :users end end
Ruby
# Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Ruby
require 'sinatra.rb' # Sinatra defines #set at the top level as a way to set application configuration set :run, false set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development) require './main' run Sinatra::Application
Ruby
# 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
# $ext_path: This should be the path of where the ExtJS SDK is installed # Generally this will be in a lib/extjs folder in your applications root # <root>/lib/extjs $ext_path = "../../" # sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder # Generally this will be in a resource...
Ruby
# include the utils rb file which has extra functionality for the ext theme dir = File.dirname(__FILE__) require File.join(dir, 'lib', 'utils.rb') # register ext4 as a compass framework Compass::Frameworks.register 'ext4', dir
Ruby
# $ext_path: This should be the path of where the ExtJS SDK is installed # Generally this will be in a lib/extjs folder in your applications root # <root>/lib/extjs $ext_path = "../../lib/extjs" # sass_path: the directory your Sass files are in. THIS file should also be in the Sass folder # Generally this will be in a...
Ruby
module ExtJS4 module SassExtensions module Functions module Utils def parsebox(list, n) assert_type n, :Number if !n.int? raise ArgumentError.new("List index #{n} must be an integer") elsif n.to_i < 1 raise ArgumentError.new("List index #{n} must...
Ruby
# Get the directory that this configuration file exists in dir = File.dirname(__FILE__) # Load the sencha-touch framework automatically. load File.join(dir, '..', '..', 'touch', 'resources', 'themes') # Compass configurations sass_path = dir css_path = File.join(dir, "..", "css") # Require any additional compass plu...
Ruby
# Get the directory that this configuration file exists in dir = File.dirname(__FILE__) # Load the sencha-touch framework automatically. load File.join(dir, '..', 'themes') # Compass configurations fonts_path = File.join(dir, '..', 'themes/fonts/') sass_path = dir css_path = File.join(dir, "..", "css") environment =...
Ruby
# Get the directory that this configuration file exists in dir = File.dirname(__FILE__) # Load the sencha-touch framework automatically. load File.join(dir, '..', 'themes') # Compass configurations sass_path = dir css_path = File.join(dir, "..", "css-debug") fonts_path = File.join(dir, '..', 'themes/fonts/')...
Ruby
# This file registers the sencha-touch framework with compass # It's a magic name that compass knows how to find. dir = File.dirname(__FILE__) require File.join(dir, 'lib', 'theme_images.rb') # Include compass-recipes require File.join(File.dirname(__FILE__), 'vendor', 'compass-recipes', 'config') Compass::BrowserSup...
Ruby
stylesheet 'sencha-touch.scss'
Ruby
module SenchaTouch module SassExtensions module Functions module ThemeImages def theme_image(theme, path, mime_type = nil) path = path.value images_path = File.join(File.dirname(__FILE__), "..", "images", theme.value) real_path = File.join(images_path, path) i...
Ruby
# 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
# 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