mirror of
https://github.com/rvtr/ctr_mcu.git
synced 2025-10-31 13:51:10 -04:00
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_mcu@344 013db118-44a6-b54f-8bf7-843cb86687b1
60 lines
1.2 KiB
Ruby
60 lines
1.2 KiB
Ruby
#!/usr/bin/ruby -Ks
|
|
|
|
tasklist = Array.new
|
|
|
|
|
|
if( ARGV[0] == nil )
|
|
printf( "既定ファイル renge_tasks.txt を使用します" )
|
|
datfile = "renge_tasks.txt"
|
|
else
|
|
datfile = ARGV[0]
|
|
end
|
|
|
|
if( !File.exist?( datfile ) )
|
|
printf("設定ファイルが見つかりません。")
|
|
exit( 1 )
|
|
end
|
|
|
|
|
|
setting = File.open( datfile )
|
|
|
|
setting.each{|dat|
|
|
dat.chomp!
|
|
if( dat != nil )
|
|
tasklist << dat
|
|
end
|
|
}
|
|
|
|
tasklist.each{|dat|
|
|
printf( "\n%s" , dat )
|
|
}
|
|
printf( "\n----------\nタスク数 %d \n", tasklist.size )
|
|
|
|
|
|
#----- 静的タスクの列挙 -------------------------------------------------------
|
|
conf = File.new( "renge_task_intval.h", "w+" )
|
|
|
|
conf << "/*スクリプトによる自動生成です。手動で書き換えない方がよいです*/\n\n"
|
|
conf << "#ifndef __renge_task__\n#define __renge_task__\n\n"
|
|
conf << "#include \"renge_defs.h\"\n\n"
|
|
|
|
conf << "enum {\n "
|
|
tasklist.each{|dat|
|
|
conf << "TSK_" << dat.upcase << ", "
|
|
}
|
|
conf << "TSK_LAST \n };\n\n"
|
|
|
|
|
|
tasklist.each{|dat|
|
|
conf << "extern void tsk_" << dat << "();\n"
|
|
}
|
|
conf << "\n"
|
|
|
|
conf << "const void ( *tasks[ TSK_LAST ] )() = {\n"
|
|
tasklist.each{|dat|
|
|
conf << " tsk_" << dat << ",\n"
|
|
}
|
|
conf << " };\n"
|
|
|
|
conf << "\n#endif\n"
|