Class: ATK1KernelPlugin

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

Overview

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

Constant Summary collapse

@@cell_list =
@option

String :オプション文字列

[]

Constants inherited from Plugin

Plugin::PluginArgProc

Class Method Summary collapse

Instance Method Summary collapse

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) ⇒ ATK1KernelPlugin

signature

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



46
47
48
# File 'lib/tecsgen/plugin/ATK1KernelPlugin.rb', line 46

def initialize(celltype, option)
  super
end

Class Method Details

.gen_post_code(file) ⇒ Object



269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# File 'lib/tecsgen/plugin/ATK1KernelPlugin.rb', line 269

def self.gen_post_code(file)
  @@cell_list.each {|cell|
    join = cell.get_join_list.get_item(:useResourceScheduler)
    if join
      flag = join.get_rhs.to_s
      if flag == "TRUE"
        file.print <<EOT
cell tResource RES_SCHEDULER {
	property = "STANDARD";
};
EOT
      else
        file.print <<EOT
EOT
      end
    end
  }
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


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
196
197
198
199
200
201
202
203
204
205
206
207
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
260
261
262
263
264
265
266
267
# File 'lib/tecsgen/plugin/ATK1KernelPlugin.rb', line 85

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

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

    if cell.is_generate?

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

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

      # STARTUPHOOK
      join = cell.get_join_list.get_item(:useStartupHook)
      if join
        str = join.get_rhs.to_s
        file2.print "\t\tSTARTUPHOOK = #{str};\n"
      end

      # ERRORHOOK
      join = cell.get_join_list.get_item(:useErrorHook)
      if join
        str = join.get_rhs.to_s
        file2.print "\t\tERRORHOOK = #{str};\n"
      end

      # SHUTDOWNHOOK
      join = cell.get_join_list.get_item(:useShutdownHook)
      if join
        str = join.get_rhs.to_s
        file2.print "\t\tSHUTDOWNHOOK = #{str};\n"
      end

      # PRETASKHOOK
      join = cell.get_join_list.get_item(:usePreTaskHook)
      if join
        str = join.get_rhs.to_s
        file2.print "\t\tPRETASKHOOK = #{str};\n"
      end

      # POSTASKHOOK
      join = cell.get_join_list.get_item(:usePostTaskHook)
      if join
        str = join.get_rhs.to_s
        file2.print "\t\tPOSTTASKHOOK = #{str};\n"
      end

      # USEGETSERVICEID
      join = cell.get_join_list.get_item(:useGetServiceId)
      if join
        str = join.get_rhs.to_s
        file2.print "\t\tUSEGETSERVICEID = #{str};\n"
      end

      # USEPARAMETERACCESS
      join = cell.get_join_list.get_item(:useParameterAccess)
      if join
        str = join.get_rhs.to_s
        file2.print "\t\tUSEPARAMETERACCESS = #{str};\n"
      end

      # USERESSCHEDULER
      join = cell.get_join_list.get_item(:useResourceScheduler)
      if join
        str = join.get_rhs.to_s
        file2.print "\t\tUSERESSCHEDULER = #{str};\n"
      end

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

    end

  }

  file2.close

  # 追記するために AppFile を使う(文字コード変換されない)
  file2 = AppFile.open("#{$gen}/tKernel_tecsgen.#{$c_suffix}")
  file2.print "\n/* Generated by ATK1KernelPlugin */\n\n"
  @celltype.get_cell_list.each {|cell|
    if cell.is_generate?
      name_array = @celltype.get_name_array(cell)

      join = cell.get_join_list.get_item(:useStartupHook)
      if join
        str = join.get_rhs.to_s
        if str == "TRUE"
          file2.print <<EOT
#ifdef USE_STARTUPHOOK
void StartupHook(void)
{
/*    CELLCB *p_cellcb = #{name_array[8]}; */
  INT32 i;
  for(i = 0; i < N_CP_cStartupHookBody; i++){
      cStartupHookBody_main(i);
  }
}
#endif /* USE_STARTUPHOOK */
EOT
        end
      end

      join = cell.get_join_list.get_item(:useErrorHook)
      if join
        str = join.get_rhs.to_s
        if str == "TRUE"
          file2.print <<EOT
#ifdef USE_ERRORHOOK
void ErrorHook(StatusType ercd)
{
/*    CELLCB *p_cellcb = #{name_array[8]}; */
  cErrorHookBody_main( ercd );
}
#endif /* USE_ERRORHOOK */

EOT
        end
      end

      join = cell.get_join_list.get_item(:useShutdownHook)
      if join
        str = join.get_rhs.to_s
        if str == "TRUE"
          file2.print <<EOT
#ifdef USE_SHUTDOWNHOOK
void ShutdownHook(StatusType ercd)
{
/*    CELLCB *p_cellcb = #{name_array[8]}; */
  INT32 i;
  for(i = 0; i < N_CP_cShutdownHookBody; i++){
      cShutdownHookBody_main( i, ercd );
  }
}
#endif /* USE_SHUTDOWNHOOK */

EOT
        end
      end

      join = cell.get_join_list.get_item(:usePreTaskHook)
      if join
        str = join.get_rhs.to_s
        if str == "TRUE"
          file2.print <<EOT
#ifdef USE_PRETASKHOOK
void PreTaskHook(void)
{
/*    CELLCB *p_cellcb = #{name_array[8]}; */
  cPreTaskHookBody_main();
}
#endif /* USE_PRETASKHOOK */

EOT
        end
      end

      join = cell.get_join_list.get_item(:usePostTaskHook)
      if join
        str = join.get_rhs.to_s
        if str == "TRUE"
          file2.print <<EOT
#ifdef USE_POSTTASKHOOK
void PostTaskHook(void)
{
/*    CELLCB *p_cellcb = #{name_array[8]}; */
  cPostTaskHookBody_main();
}
#endif /* USE_POSTTASKHOOK */

EOT
        end
      end

    end
  }

  file2.close
end

#new_cell(cell) ⇒ Object

def gen_cdl_file file

end


59
60
61
62
63
64
65
66
67
68
# File 'lib/tecsgen/plugin/ATK1KernelPlugin.rb', line 59

def new_cell(cell)
#    join_list = cell.get_join_list
#    a = join_list.get_item( :resource )
#    if a == nil
#     Generator.error( "resource: must be initialized")
#    elsif ! a.get_rhs.instance_of? Array
#      Generator.error( "resource: initializer must be in format of '{val1, val2 ...}'")
#    end
  @@cell_list << cell
end