Class: FuncHead
- Inherits:
-
BDNode
show all
- Defined in:
- lib/tecsgen/core/syntaxobj.rb,
lib/tecsgen/core/tecsinfo.rb
Overview
Instance Method Summary
collapse
Methods inherited from BDNode
#get_owner, #set_owner
Methods inherited from Node
#cdl_error, #cdl_error2, #cdl_error3, #cdl_info, #cdl_info2, #cdl_warning, #cdl_warning2, #get_locale, #locale_str, #set_locale
Constructor Details
#initialize(declarator, type, b_oneway) ⇒ FuncHead
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
|
# File 'lib/tecsgen/core/syntaxobj.rb', line 363
def initialize(declarator, type, b_oneway)
super()
declarator.set_type(type)
@declarator = declarator
@declarator.set_owner self
if @declarator.get_type.is_a?(FuncType)
if b_oneway
@declarator.get_type.set_oneway(b_oneway)
end
end
@declarator.get_type.check_struct_tag :FUNCHEAD
if declarator.get_type.is_a? FuncType
if declarator.get_type.get_type.get_original_type.is_a?(PtrType) &&
Signature.get_current.is_deviate? == false
cdl_warning("W3004 $1 pointer type has returned. specify deviate or stop return pointer", @declarator.get_identifier)
end
end
end
|
Instance Method Details
#get_declarator ⇒ Object
389
390
391
|
# File 'lib/tecsgen/core/syntaxobj.rb', line 389
def get_declarator
@declarator
end
|
405
406
407
|
# File 'lib/tecsgen/core/syntaxobj.rb', line 405
def get_name
@declarator.get_name
end
|
#get_paramlist ⇒ Object
FuncHead# 関数の引数のリストを返す
ParamList を返す関数ヘッダの定義として不完全な場合 nil を返す
421
422
423
424
425
|
# File 'lib/tecsgen/core/syntaxobj.rb', line 421
def get_paramlist
if is_function?
return @declarator.get_type.get_paramlist
end
end
|
#get_return_type ⇒ Object
FuncHead# 関数の戻り値の型を返す
types.rb に定義されている型関数ヘッダの定義として不完全な場合 nil を返す
412
413
414
415
416
|
# File 'lib/tecsgen/core/syntaxobj.rb', line 412
def get_return_type
if is_function?
return @declarator.get_type.get_type
end
end
|
#is_function? ⇒ Boolean
400
401
402
|
# File 'lib/tecsgen/core/syntaxobj.rb', line 400
def is_function?
@declarator.is_function?
end
|
#is_oneway? ⇒ Boolean
393
394
395
396
397
398
|
# File 'lib/tecsgen/core/syntaxobj.rb', line 393
def is_oneway?
if @declarator.is_function?
return @declarator.get_type.is_oneway?
end
return false
end
|
#print_info(f, indent) ⇒ Object
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
|
# File 'lib/tecsgen/core/tecsinfo.rb', line 686
def print_info(f, indent)
sig_name = @owner.get_global_name
func_name = get_name
f.print <<EOT
#{indent}cell nTECSInfo::tFunctionInfo #{sig_name}_#{func_name}FunctionInfo {
#{indent} name = "#{get_name}";
#{indent} bOneway = #{is_oneway?};
EOT
get_paramlist.get_items.each{|param|
f.print <<EOT
#{indent} cParamInfo[] = #{sig_name}_#{func_name}_#{param.get_name}ParamInfo.eParamInfo;
EOT
}
f.print <<EOT
#{indent} cReturnTypeInfo = #{get_return_type.get_ID_str}TypeInfo.eTypeInfo;
#{indent}};
EOT
get_paramlist.get_items.each{|param|
dbgPrint "param_list #{sig_name}, #{func_name}, #{param.get_name}\n"
param.print_info f, sig_name, func_name, get_paramlist, indent
}
get_return_type.print_info f, indent
end
|
#show_tree(indent) ⇒ Object
427
428
429
430
431
|
# File 'lib/tecsgen/core/syntaxobj.rb', line 427
def show_tree(indent)
indent.times { print " " }
puts "FuncHead: #{locale_str}"
@declarator.show_tree(indent + 1)
end
|