Class: NotifierPlugin::AdapterGenerator
- Inherits:
-
Object
- Object
- NotifierPlugin::AdapterGenerator
show all
- Defined in:
- lib/tecsgen/plugin/NotifierPlugin.rb
Defined Under Namespace
Classes: EntryPort, EntryProperty
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(celltype_name, prefix) ⇒ AdapterGenerator
317
318
319
320
321
322
323
|
# File 'lib/tecsgen/plugin/NotifierPlugin.rb', line 317
def initialize(celltype_name, prefix)
@celltype_name = celltype_name
@prefix = prefix
@entry_ports = {}
end
|
Instance Attribute Details
313
314
315
|
# File 'lib/tecsgen/plugin/NotifierPlugin.rb', line 313
def
end
|
#source_file ⇒ Object
310
311
312
|
# File 'lib/tecsgen/plugin/NotifierPlugin.rb', line 310
def source_file
@source_file
end
|
Instance Method Details
AdapterGenerator#finish===
各受け口に対し,アダプタ関数を生成する.
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
|
# File 'lib/tecsgen/plugin/NotifierPlugin.rb', line 340
def finish
@source_file = AppFile.open("#{$gen}/#{@celltype_name}.c")
@source_file.print "\n/* Generated by #{self.class.name} */\n\n"
@source_file.print "\#include \"#{@celltype_name}_aux.h\"\n\n"
@source_file.print "\#include \"#{@celltype_name}_tecsgen.h\"\n\n"
= AppFile.open("#{$gen}/#{@celltype_name}.h")
.print "\n/* Generated by #{self.class.name} */\n\n"
= "#{@celltype_name}_H_#{@prefix}"
.print "\#ifndef #{header_guard}\n"
.print "\#define #{header_guard}\n\n"
.print "\#include \"#{@celltype_name}_aux.h\"\n\n"
= AppFile.open("#{$gen}/#{@celltype_name}_aux.h")
.print "\n/* Generated by #{self.class.name} */\n\n"
= "#{@celltype_name}_AUX_H_#{@prefix}"
.print "\#ifndef #{aux_header_guard}\n"
.print "\#define #{aux_header_guard}\n\n"
cb_type_only_guard = "#{@celltype_name}_AUX_H_#{@prefix}_CB_TYPE_ONLY"
.print "#ifndef TOPPERS_CB_TYPE_ONLY\n"
.print "#define TOPPERS_CB_TYPE_ONLY\n"
.print "#define #{cb_type_only_guard}\n"
.print "#endif\n"
@entry_ports.values.map {|ep|
ep.port.get_celltype
}.uniq.each {|ct|
hname = "#{ct.get_global_name}_tecsgen.#{$h_suffix}"
.print "\#include \"#{hname}\"\n"
}
.print "#ifdef #{cb_type_only_guard}\n"
.print "#undef #{cb_type_only_guard}\n"
.print "#undef TOPPERS_CB_TYPE_ONLY\n"
.print "#endif\n\n"
.print "\#endif\n"
.close
@entry_ports.each {|port, entry_port|
entry_port.generate self
}
.print "\#endif\n"
@source_file.close
.close
end
|
#make_adapter_handle(join) ⇒ Array
AdapterGenerator#make_adapter_handle===
指定した結合の呼出しを行うためのアダプタ関数ハンドルを生成する.
328
329
330
331
332
333
334
335
336
|
# File 'lib/tecsgen/plugin/NotifierPlugin.rb', line 328
def make_adapter_handle(join)
entry_port = @entry_ports[join.get_rhs_port]
unless entry_port
entry_port = EntryPort.new(join.get_rhs_port,
"#{@celltype_name}_#{@prefix}")
@entry_ports[join.get_rhs_port] = entry_port
end
return entry_port.make_adapter_handle(join)
end
|