Class: ATK1AlarmPlugin

Inherits:
CelltypePlugin show all
Defined in:
lib/tecsgen/plugin/ATK1AlarmPlugin.rb

Overview

celltype プラグインの共通の親クラス

Constant Summary

Constants inherited from Plugin

Plugin::PluginArgProc

Instance Method Summary collapse

Methods inherited from CelltypePlugin

gen_post_code

Methods inherited from Plugin

#cdl_error, #check_plugin_arg, #gen_cdl_file, #gen_ep_func?, #gen_postamble, #gen_preamble, #parse_plugin_arg, #print_msg, #set_locale, #set_silent

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(celltype, option) ⇒ ATK1AlarmPlugin

signature

Celltype シグニチャ(インスタンス)



45
46
47
# File 'lib/tecsgen/plugin/ATK1AlarmPlugin.rb', line 45

def initialize(celltype, option)
  super
end

Instance Method Details

#gen_factory(file) ⇒ Object

def gen_ep_func_body( file, b_singleton, ct_name, global_ct_name, sig_name, ep_name, func_name, func_global_name, func_type, params )

end


76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
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
# File 'lib/tecsgen/plugin/ATK1AlarmPlugin.rb', line 76

def gen_factory(file)
  file2 = CFile.open("#{$gen}/ALARM_tecsgen.oil", "w")

  # ALARM
  @celltype.get_cell_list.each {|cell|

  if cell.is_generate?

    file2.print "\tALARM #{cell.get_name} {\n"

    # COUNTER
    join = cell.get_join_list.get_item(:counter)
    if join
      str = join.get_rhs.to_s.gsub(/^"(.*)"$/, '\1')
      file2.print "\t\tCOUNTER = #{str};\n"
    end

    # ACTION
    join = cell.get_join_list.get_item(:action)
    if join
      str = join.get_rhs.to_s.gsub(/^"(.*)"$/, '\1')
    end

    case str
    when "SETEVENT"
      file2.print "\t\tACTION = #{str} {\n"
      join2 = cell.get_join_list.get_item(:task)
      if join2
        str = join2.get_rhs.to_s.gsub(/^"(.*)"$/, '\1')
        file2.print "\t\t\tTASK = #{str};\n"
      end
      join2 = cell.get_join_list.get_item(:event)
      if join2
        str = join2.get_rhs.to_s.gsub(/^"(.*)"$/, '\1')
        file2.print "\t\t\tEVENT = #{str};\n"
      end
      file2.print "\t\t};\n"
    when "ACTIVATETASK"
      file2.print "\t\tACTION = #{str} {\n"
      join2 = cell.get_join_list.get_item(:task)
      if join2
        str = join2.get_rhs.to_s.gsub(/^"(.*)"$/, '\1')
        file2.print "\t\t\tTASK = #{str};\n"
      end
      file2.print "\t\t};\n"
    when "ALARMCALLBACK"
      file2.print "\t\tACTION = #{str} {\n"
      join2 = cell.get_join_list.get_item(:callbackName)
      if join2
        str = join2.get_rhs.to_s
        file2.print "\t\t\tALARMCALLBACKNAME = #{str};\n"
      end
      file2.print "\t\t};\n"
    else
    end

    # AUTOSTART
    join = cell.get_join_list.get_item(:autoStart)
    if join
      str = join.get_rhs.to_s
    end

    if str == "TRUE"
      file2.print "\t\tAUTOSTART = TRUE {\n"
      join2 = cell.get_join_list.get_item(:alarmTime)
      if join2
        str = join2.get_rhs.to_s
      file2.print "\t\t\tALARMTIME = #{str};\n"
      end
      join2 = cell.get_join_list.get_item(:cycleTime)
      if join2
        str = join2.get_rhs.to_s
        file2.print "\t\t\tCYCLETIME = #{str};\n"
      end
      join2 = cell.get_join_list.get_item(:appMode)
      delim = ""
      if join2
        join2.get_rhs.each {|mode|
          str = mode.to_s.gsub(/^"(.*)"$/, '\1')
          file2.print "\t\t\tAPPMODE = #{str};\n"
          delim = ";"
        }
      end
      file2.print "\t\t};\n"
    else
      file2.print "\t\tAUTOSTART = FALSE;\n"
    end

    file2.print "\t};\n"
    file2.print "\n"

  end
}

file2.close

# 追記するために AppFile を使う(文字コード変換されない)
file = AppFile.open("#{$gen}/tAlarm_tecsgen.#{$c_suffix}")
file.print "\n/* Generated by ATK1AlarmPlugin */\n"
@celltype.get_cell_list.each {|cell|
  if cell.is_generate?
    name_array = @celltype.get_name_array(cell)
    join2 = cell.get_join_list.get_item(:callbackName)
    if join2
      str = join2.get_rhs.to_s.gsub(/^"(.*)"$/, '\1')
      file.print <<EOT
ALARMCALLBACK( #{str} );
ALARMCALLBACK( #{str} )
{
  CELLCB *p_cellcb = #{name_array[8]};
  cBody_main();
}

EOT
    end
  end
}

file.close
end

#new_cell(cell) ⇒ Object

def gen_cdl_file file

end


58
59
# File 'lib/tecsgen/plugin/ATK1AlarmPlugin.rb', line 58

def new_cell(cell)
end