module IDL

RIDL is a Ruby library implementing an OMG IDL parser/compiler frontend with support for pluggable (and stackable) backends.

RIDL itself implements an IDL parser (RACC based) in IDL::Parser in combination with IDL::Scanner, syntax tree classes under IDL::AST, type classes under IDL::Type and expression classes under IDL::Expression. Furthermore RIDL implements a number of support classes useful in the implementation of backends for RIDL.

RIDL does not implement any standard backend to handle things like code generation and/or documentation generation but instead provides a framework for user defined pluggable backends. Known backends for RIDL are the R2CORBA RIDL backend and the IDL2C++11 backend.


Constants

CORE_OPTIONS
OPTIONS
ORB_PIDL
RIDLRC
RIDLRC_GLOBAL
RIDL_VERSION
RIDL_VERSION_MAJOR
RIDL_VERSION_MINOR
RIDL_VERSION_RELEASE

Public Class Methods

backend() click to toggle source
# File lib/ridl/runner.rb, line 415
def IDL.backend
  Thread.current[:ridl_engine] ? Thread.current[:ridl_engine].backend : nil
end
engine?() click to toggle source
# File lib/ridl/runner.rb, line 411
def IDL.engine?
  !Thread.current[:ridl_engine].nil?
end
error(message) click to toggle source
# File lib/ridl/runner.rb, line 485
def IDL.error(message)
  STDERR.puts(message)
end
fatal(message) click to toggle source
# File lib/ridl/runner.rb, line 489
def IDL.fatal(message)
  STDERR.puts(message, 'Exiting.')
  exit 1
end
has_input?() click to toggle source
# File lib/ridl/runner.rb, line 435
def IDL.has_input?
  engine? && Thread.current[:ridl_engine].has_input?
end
has_production?(id) click to toggle source
# File lib/ridl/runner.rb, line 459
def IDL.has_production?(id)
  engine? && Thread.current[:ridl_engine].has_production?(id)
end
has_productions?() click to toggle source
# File lib/ridl/runner.rb, line 455
def IDL.has_productions?
  engine? && Thread.current[:ridl_engine].has_productions?
end
init(argv = ARGV) click to toggle source
# File lib/ridl/runner.rb, line 494
def IDL.init(argv = ARGV)
  options = OPTIONS.dup

  # load config file(s) if any
  Options.load_config(options)

  IDL.log(2, "Configuration [#{options}]")

  # check commandline args for explicit language mapping backend
  if argv.first =~ /^:\S+/
    be_name = argv.shift.reverse.chop.reverse.to_sym
  elsif ENV['RIDL_BE_SELECT']   # or from environment
    be_name = ENV['RIDL_BE_SELECT'].to_sym
  elsif options[:backend]       # or from configuration
    be_name = options[:backend].to_sym
  end

  # add optional search paths for RIDL backends
  options[:be_path] ||= []
  options[:be_path].unshift(*ENV['RIDL_BE_PATH'].split(/#{File::PATH_SEPARATOR}/)) if ENV['RIDL_BE_PATH']
  options[:be_path].collect! { |p| p.gsub('\\', '/') } # cleanup to prevent mixed path separators
  $:.concat(options[:be_path]) unless options[:be_path].empty?

  # check for special bootstrapping switches
  if argv.first == '--preprocess'
    options[:preprocess] = true
    argv.shift
  elsif argv.first == '--ignore-pidl'
    options[:ignore_pidl] = true
    argv.shift
  end

  # create RIDL engine
  Thread.current[:ridl_engine] = Engine.new(be_name, options)
end
log(level, message) click to toggle source
# File lib/ridl/runner.rb, line 481
def IDL.log(level, message)
  STDERR.puts message if verbose_level >= level
end
peek_input() click to toggle source
# File lib/ridl/runner.rb, line 429
def IDL.peek_input
  return nil unless engine?

  Thread.current[:ridl_engine].peek_input
end
pop_input() click to toggle source
# File lib/ridl/runner.rb, line 423
def IDL.pop_input
  return nil unless engine?

  Thread.current[:ridl_engine].pop_input
end
pop_production() click to toggle source
# File lib/ridl/runner.rb, line 443
def IDL.pop_production
  return nil unless engine?

  Thread.current[:ridl_engine].pop_production
end
production(id) click to toggle source
# File lib/ridl/runner.rb, line 463
def IDL.production(id)
  return nil unless engine?

  Thread.current[:ridl_engine].production(id)
end
push_input(idlfile, opts) click to toggle source
# File lib/ridl/runner.rb, line 419
def IDL.push_input(idlfile, opts)
  Thread.current[:ridl_engine].push_input(idlfile, opts) if engine?
end
push_production(id, producer) click to toggle source
# File lib/ridl/runner.rb, line 439
def IDL.push_production(id, producer)
  Thread.current[:ridl_engine].push_production(id, producer) if engine?
end
remove_production(id) click to toggle source
# File lib/ridl/runner.rb, line 449
def IDL.remove_production(id)
  return nil unless engine?

  Thread.current[:ridl_engine].remove_production(id)
end
run(argv = ARGV) click to toggle source

main run method

# File lib/ridl/runner.rb, line 532
def IDL.run(argv = ARGV)
  # run default engine if available
  if Thread.current[:ridl_engine]
    exit(1) unless Thread.current[:ridl_engine].run(argv)
  end
end
verbose_level() click to toggle source
# File lib/ridl/runner.rb, line 469
def IDL.verbose_level
  Thread.current[:ridl_engine] ? Thread.current[:ridl_engine].verbose_level : OPTIONS[:verbose]
end
verbose_level=(l) click to toggle source
# File lib/ridl/runner.rb, line 473
def IDL.verbose_level=(l)
  if Thread.current[:ridl_engine]
    Thread.current[:ridl_engine].verbose_level = l.to_i
  else
    OPTIONS[:verbose] = l.to_i
  end
end