Sha256: 885570e8bf43b80fedb81bfcc2ae5fa54d77745f331355a3ce83a25424702630
Contents?: true
Size: 1.22 KB
Versions: 6
Compression:
Stored size: 1.22 KB
Contents
# 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 exemple illustrates the use of the cparser/preprocessor #factorize functionnality: # we write some code using standard headers, and the factorize call on CParser # gives us back the macro/C definitions that we use in our code, so that we can # get rid of the header # Argument: C file to factorize, [path to visual studio installation] # with a single argument, uses GCC standard headers # require 'metasm' include Metasm abort 'target needed' if not file = ARGV.shift visualstudiopath = ARGV.shift if visualstudiopath stub = <<EOS // add the path to the visual studio std headers #ifdef __METASM__ #pragma include_dir #{(visualstudiopath+'/platformsdk/include').inspect} #pragma include_dir #{(visualstudiopath+'/include').inspect} #pragma prepare_visualstudio #pragma no_warn_redefinition #endif EOS else stub = <<EOS #ifdef __METASM__ #pragma prepare_gcc #endif EOS end stub << "#line 0\n" # to trace only pp macros (using eg an asm source), use Preprocessor#factorize instead puts Ia32.new.new_cparser.factorize(stub + File.read(file), file)
Version data entries
6 entries across 6 versions & 1 rubygems