Module: IDL::Ruby
- Defined in:
- lib/ridlbe/ruby/config.rb
Overview
module RIDL
Defined Under Namespace
Modules: LeafMixin, ScannerMixin
Constant Summary collapse
- COPYRIGHT =
"Copyright (c) 2007-#{Time.now.year} Remedy IT Expertise BV, The Netherlands".freeze
- TITLE =
'RIDL Ruby backend'.freeze
- VERSION =
{ :major => 2, :minor => 0, :release => 1 }
Class Method Summary collapse
-
.process_input(parser, options, outstream = nil) ⇒ Object
Backend.configure.
Instance Method Summary collapse
-
#ruby ⇒ Object
Configure Ruby backend.
Class Method Details
.process_input(parser, options, outstream = nil) ⇒ Object
Backend.configure
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
# File 'lib/ridlbe/ruby/config.rb', line 208 def self.process_input(parser, , outstream = nil) # has a user defined output filename been set fixed_output = ![:output].nil? # determine output file path for client stub code unless fixed_output || [:idlfile].nil? [:output] = [:outputdir] + '/' + File.basename([:idlfile], '.idl') + [:stub_pfx] + '.rb' end # generate client stubs if requested if [:client_stubs] # open output file co = outstream || (if [:output].nil? GenFile.new(nil, :output_file => $stdout) else GenFile.new([:output]) end) begin # process StubWriter parser.visit_nodes(::IDL::RubyStubWriter.new(co, )) rescue => ex IDL.log(0, ex) IDL.log(0, ex.backtrace.join("\n")) unless ex.is_a? IDL::ParseError exit 1 end end # determin output file path for servant code and open file unless [:stubs_only] so = outstream || (unless fixed_output || [:idlfile].nil? [:srv_output] = if fixed_output [:output] else [:outputdir] + '/' + File.basename([:idlfile], '.idl') + [:srv_pfx] + '.rb' end if fixed_output && [:client_stubs] co else GenFile.new([:srv_output]) end else GenFile.new(nil, :output_file => $stdout) end) begin # process ServantWriter parser.visit_nodes(::IDL::RubyServantWriter.new(so, )) rescue => ex IDL.log(0, ex) IDL.log(0, ex.backtrace.join("\n")) unless ex.is_a? IDL::ParseError exit 1 end end end |
Instance Method Details
#ruby ⇒ Object
Configure Ruby backend
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/ridlbe/ruby/config.rb', line 100 Backend.configure('ruby', File.dirname(__FILE__), TITLE, COPYRIGHT, VERSION) do |becfg| # setup backend option handling # becfg.on_setup do |optlist, ridl_params| # defaults ridl_params[:stub_pfx] = 'C' ridl_params[:srv_pfx] = 'S' ridl_params[:stubs_only] = false ridl_params[:client_stubs] = true ridl_params[:expand_includes] = false ridl_params[:libinit] = true ridl_params[:class_interfaces] = [] # ruby specific option switches unless ridl_params[:preprocess] # same switch defined for IDL preprocessing mode optlist.for_switch '--output=FILE', :type => String, :description => ['Specifies filename to generate output in.', 'Default: File.basename(idlfile, \'.idl\')+<postfix>+<ext>'] do |swcfg| swcfg.on_exec do |arg, params| params[:output] = arg end end end optlist.for_switch '-o PATH', :type => String, :description => ['Specifies output directory.', 'Default: ./'] do |swcfg| swcfg.on_exec do |arg, params| params[:outputdir] = arg end end optlist.for_switch '--stubs-only', :description => ['Only generate client stubs, no servant code.', 'Default: off'] do |swcfg| swcfg.on_exec do |arg, params| params[:client_stubs] = true params[:stubs_only] = true end end optlist.for_switch '--no-stubs', :description => ['Do not generate client stubs, only servant code.', 'Default: off'] do |swcfg| swcfg.on_exec do |arg, params| params[:client_stubs] = false params[:stubs_only] = false end end optlist.for_switch '--stub-pfx=POSTFIX', :type => String, :description => ['Specifies postfix for generated client stub source filename.', 'Filenames are formed like: <idl basename><postfix>.<language extension>', "Default: #{ridl_params[:stub_pfx]}"] do |swcfg| swcfg.on_exec do |arg, params| params[:stub_pfx] = arg end end optlist.for_switch '--skel-pfx=POSTFIX', :type => String, :description => ['Specifies postfix for generated servant skeleton source filename.', 'Filenames are formed like: <idl basename><postfix>.<language extension>', "Default: #{ridl_params[:srv_pfx]}"] do |swcfg| swcfg.on_exec do |arg, params| params[:srv_pfx] = arg end end optlist.for_switch '--skel-directory=PATH', :type => String, :description => ['Specifies output directory for servant files.', 'Default: outputdir or ./'] do |swcfg| swcfg.on_exec do |arg, params| params[:skel_outputdir] = arg end end optlist.for_switch '--expand-includes', :description => ['Generate code for included IDL inline.', 'Default: off'] do |swcfg| swcfg.on_exec do |arg, params| params[:expand_includes] = true end end optlist.for_switch '--no-libinit', :description => ['Do not generate library initialization code as preamble.', 'Default: on'] do |swcfg| swcfg.on_exec do |arg, params| params[:libinit] = false end end optlist.for_switch '--interface-as-class=INTF', :type => String, :description => ['Generate a Ruby class for interface INTF instead of a module in client stubs.', 'Default: module'] do |swcfg| swcfg.on_exec do |arg, params| params[:class_interfaces] << arg end end end # process input / generate code # arguments: # in parser - parser object with full AST from parsed source # in options - initialized option hash # becfg.on_process_input do |parser, | IDL::Ruby.process_input(parser, ) end # becfg.on_process_input end |