This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class C | |
include AdLint::C::ScannerConstants | |
extend AdLint::C::Scanner | |
class << self | |
def single_module_phases | |
[ | |
AdLint::Cpp::PreparePhase, | |
# Snip... | |
].freeze |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
lang.single_module_phases.each do |phase_class| | |
phase_class.new(context).execute | |
end | |
ensure | |
# snip... | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
# ...snip... | |
gem 'adlint', version | |
load Gem.bin_path('adlint', 'adlintize', version) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IO | |
def unpack!(ptn) | |
ptn2 = ptn.dup | |
until ptn2.empty? | |
len += case ptn2 | |
when /\*/ | |
len = nil | |
break | |
when /^[aAcCx](\d+)/ | |
$1 ? $1.to_i : 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
def unpack!(fmt) | |
ret = unpack(fmt) | |
slice!(0,ret.pack(fmt).size) | |
ret | |
end | |
end | |
# Use like this. | |
str = "\0\xaa\x01\x55\xff" |