| 1 | #! /usr/bin/perl |
|---|
| 2 | # |
|---|
| 3 | # TOPPERS Software |
|---|
| 4 | # Toyohashi Open Platform for Embedded Real-Time Systems |
|---|
| 5 | # |
|---|
| 6 | # Copyright (C) 2007-2014 by Embedded and Real-Time Systems Laboratory |
|---|
| 7 | # Graduate School of Information Science, Nagoya Univ., JAPAN |
|---|
| 8 | # |
|---|
| 9 | # ŸåµÃøºîž¢ŒÔ€Ï¡€°Ê²Œ€Î(1)¡Á(4)€ÎŸò·ï€òËþ€¿€¹Ÿì¹ç€ËžÂ€ê¡€ËÜ¥œ¥Õ¥È¥Š¥§ |
|---|
| 10 | # ¥¢¡ÊËÜ¥œ¥Õ¥È¥Š¥§¥¢€ò²þÊÑ€·€¿€â€Î€òŽÞ€à¡¥°Ê²ŒÆ±€ž¡Ë€ò»ÈÍÑ¡ŠÊ£Àœ¡Š²þ |
|---|
| 11 | # ÊÑ¡ŠºÆÇÛÉۡʰʲŒ¡€ÍøÍрȞƀ֡ˀ¹€ë€³€È€ò̵œþ€ÇµöÂú€¹€ë¡¥ |
|---|
| 12 | # (1) ËÜ¥œ¥Õ¥È¥Š¥§¥¢€ò¥œ¡Œ¥¹¥³¡Œ¥É€Î·Á€ÇÍøÍÑ€¹€ëŸì¹ç€Ë€Ï¡€Ÿåµ€ÎÃøºî |
|---|
| 13 | # ž¢ÉœŒš¡€€³€ÎÍøÍÑŸò·ï€ª€è€Ó²Œµ€Î̵ÊÝŸÚµ¬Äꀬ¡€€œ€Î€Þ€Þ€Î·Á€Ç¥œ¡Œ |
|---|
| 14 | # ¥¹¥³¡Œ¥ÉÃæ€ËŽÞ€Þ€ì€Æ€€€ë€³€È¡¥ |
|---|
| 15 | # (2) ËÜ¥œ¥Õ¥È¥Š¥§¥¢€ò¡€¥é¥€¥Ö¥é¥ê·ÁŒ°€Ê€É¡€ÂŸ€Î¥œ¥Õ¥È¥Š¥§¥¢³«È¯€Ë»È |
|---|
| 16 | # Íрǀ€ë·Á€ÇºÆÇÛÉÛ€¹€ëŸì¹ç€Ë€Ï¡€ºÆÇÛÉÛ€ËÈŒ€Š¥É¥¥å¥á¥ó¥È¡ÊÍøÍÑ |
|---|
| 17 | # ŒÔ¥Þ¥Ë¥å¥¢¥ë€Ê€É¡Ë€Ë¡€Ÿåµ€ÎÃøºîž¢ÉœŒš¡€€³€ÎÍøÍÑŸò·ï€ª€è€Ó²Œµ |
|---|
| 18 | # €Î̵ÊÝŸÚµ¬Äê€ò·ÇºÜ€¹€ë€³€È¡¥ |
|---|
| 19 | # (3) ËÜ¥œ¥Õ¥È¥Š¥§¥¢€ò¡€µ¡Žï€ËÁȀ߹þ€à€Ê€É¡€ÂŸ€Î¥œ¥Õ¥È¥Š¥§¥¢³«È¯€Ë»È |
|---|
| 20 | # Íрǀ€Ê€€·Á€ÇºÆÇÛÉÛ€¹€ëŸì¹ç€Ë€Ï¡€Œ¡€Î€€€º€ì€«€ÎŸò·ï€òËþ€¿€¹€³ |
|---|
| 21 | # €È¡¥ |
|---|
| 22 | # (a) ºÆÇÛÉÛ€ËÈŒ€Š¥É¥¥å¥á¥ó¥È¡ÊÍøÍьԥޥ˥奢¥ë€Ê€É¡Ë€Ë¡€Ÿåµ€ÎÃø |
|---|
| 23 | # ºîž¢ÉœŒš¡€€³€ÎÍøÍÑŸò·ï€ª€è€Ó²Œµ€Î̵ÊÝŸÚµ¬Äê€ò·ÇºÜ€¹€ë€³€È¡¥ |
|---|
| 24 | # (b) ºÆÇÛÉۀηÁÂÖ€ò¡€ÊÌ€ËÄê€á€ëÊýË¡€Ë€è€Ã€Æ¡€TOPPERS¥×¥í¥ž¥§¥¯¥È€Ë |
|---|
| 25 | # Êó¹ð€¹€ë€³€È¡¥ |
|---|
| 26 | # (4) ËÜ¥œ¥Õ¥È¥Š¥§¥¢€ÎÍøÍрˀè€êÄŸÀÜŪ€Þ€¿€ÏŽÖÀÜŪ€ËÀž€ž€ë€€€«€Ê€ë» |
|---|
| 27 | # ³²€«€é€â¡€ŸåµÃøºîž¢ŒÔ€ª€è€ÓTOPPERS¥×¥í¥ž¥§¥¯¥È€òÌÈÀÕ€¹€ë€³€È¡¥ |
|---|
| 28 | # €Þ€¿¡€ËÜ¥œ¥Õ¥È¥Š¥§¥¢€Î¥æ¡Œ¥¶€Þ€¿€Ï¥š¥ó¥É¥æ¡Œ¥¶€«€é€Î€€€«€Ê€ëÍý |
|---|
| 29 | # ͳ€ËŽð€Å€¯ÀÁµá€«€é€â¡€ŸåµÃøºîž¢ŒÔ€ª€è€ÓTOPPERS¥×¥í¥ž¥§¥¯¥È€ò |
|---|
| 30 | # ÌÈÀÕ€¹€ë€³€È¡¥ |
|---|
| 31 | # |
|---|
| 32 | # ËÜ¥œ¥Õ¥È¥Š¥§¥¢€Ï¡€ÌµÊÝŸÚ€ÇÄó¶¡€µ€ì€Æ€€€ë€â€Î€Ç€¢€ë¡¥ŸåµÃøºîž¢ŒÔ€ª |
|---|
| 33 | # €è€ÓTOPPERS¥×¥í¥ž¥§¥¯¥È€Ï¡€ËÜ¥œ¥Õ¥È¥Š¥§¥¢€ËŽØ€·€Æ¡€ÆÃÄê€Î»ÈÍÑÌÜŪ |
|---|
| 34 | # €ËÂЀ¹€ëŬ¹çÀ€âŽÞ€á€Æ¡€€€€«€Ê€ëÊÝŸÚ€â¹Ô€ï€Ê€€¡¥€Þ€¿¡€ËÜ¥œ¥Õ¥È¥Š¥§ |
|---|
| 35 | # ¥¢€ÎÍøÍрˀè€êÄŸÀÜŪ€Þ€¿€ÏŽÖÀÜŪ€ËÀž€ž€¿€€€«€Ê€ë»³²€ËŽØ€·€Æ€â¡€€œ |
|---|
| 36 | # €ÎÀÕÇ€€òÉé€ï€Ê€€¡¥ |
|---|
| 37 | # |
|---|
| 38 | # $Id$ |
|---|
| 39 | # |
|---|
| 40 | |
|---|
| 41 | # |
|---|
| 42 | # ¥Æ¥¹¥È¥×¥í¥°¥é¥àÀžÀ®¥Ä¡Œ¥ë |
|---|
| 43 | # |
|---|
| 44 | |
|---|
| 45 | use open ":encoding(euc-jp)"; |
|---|
| 46 | use encoding "euc-jp"; |
|---|
| 47 | |
|---|
| 48 | $infile = $ARGV[0]; |
|---|
| 49 | |
|---|
| 50 | %parampos = ( |
|---|
| 51 | "get_pri" => 2, |
|---|
| 52 | "get_inf" => 1, |
|---|
| 53 | "ref_tsk" => 2, |
|---|
| 54 | "ref_tex" => 2, |
|---|
| 55 | "ref_sem" => 2, |
|---|
| 56 | "ref_flg" => 2, |
|---|
| 57 | "ref_dtq" => 2, |
|---|
| 58 | "ref_pdq" => 2, |
|---|
| 59 | "ref_mbx" => 2, |
|---|
| 60 | "ref_mtx" => 2, |
|---|
| 61 | "ref_mbf" => 2, |
|---|
| 62 | "ref_mpf" => 2, |
|---|
| 63 | "get_tim" => 1, |
|---|
| 64 | "get_utm" => 1, |
|---|
| 65 | "ref_cyc" => 2, |
|---|
| 66 | "ref_alm" => 2, |
|---|
| 67 | "get_tid" => 1, |
|---|
| 68 | "iget_tid" => 1, |
|---|
| 69 | "get_ipm" => 1, |
|---|
| 70 | ); |
|---|
| 71 | |
|---|
| 72 | %paramtype = ( |
|---|
| 73 | "get_pri" => "PRI", |
|---|
| 74 | "get_inf" => "intptr_t", |
|---|
| 75 | "ref_tsk" => "T_RTSK", |
|---|
| 76 | "ref_tex" => "T_RTEX", |
|---|
| 77 | "ref_sem" => "T_RSEM", |
|---|
| 78 | "ref_flg" => "T_RFLG", |
|---|
| 79 | "ref_dtq" => "T_RDTQ", |
|---|
| 80 | "ref_pdq" => "T_RPDQ", |
|---|
| 81 | "ref_mbx" => "T_RMBX", |
|---|
| 82 | "ref_mtx" => "T_RMTX", |
|---|
| 83 | "ref_mbf" => "T_RMBF", |
|---|
| 84 | "ref_mpf" => "T_RMPF", |
|---|
| 85 | "get_tim" => "SYSTIM", |
|---|
| 86 | "get_utm" => "SYSUTM", |
|---|
| 87 | "ref_cyc" => "T_RCYC", |
|---|
| 88 | "ref_alm" => "T_RALM", |
|---|
| 89 | "get_tid" => "ID", |
|---|
| 90 | "iget_tid" => "ID", |
|---|
| 91 | "get_ipm" => "PRI", |
|---|
| 92 | ); |
|---|
| 93 | |
|---|
| 94 | $last_check_point = 0; |
|---|
| 95 | |
|---|
| 96 | sub gen_var_def { |
|---|
| 97 | local($svc_call) = @_; |
|---|
| 98 | local($svcname, @params); |
|---|
| 99 | local($typename, $varname); |
|---|
| 100 | |
|---|
| 101 | if ($svc_call =~ /^([a-z_]+)\((.*)\)$/) { |
|---|
| 102 | $svcname = $1; |
|---|
| 103 | @params = split(/\s*,\s*/, $2); |
|---|
| 104 | |
|---|
| 105 | if ($parampos{$svcname}) { |
|---|
| 106 | $varname = $params[@parampos{$svcname} - 1]; |
|---|
| 107 | $varname =~ s/^\&//; |
|---|
| 108 | $typename = $paramtype{$svcname}; |
|---|
| 109 | ${$TASKVAR{$tskid}}{$typename} = ${varname}; |
|---|
| 110 | } |
|---|
| 111 | } |
|---|
| 112 | } |
|---|
| 113 | |
|---|
| 114 | sub gen_svc_call { |
|---|
| 115 | local($svc_call, $error_code_string) = @_; |
|---|
| 116 | local($error_code); |
|---|
| 117 | |
|---|
| 118 | ${$TASKVAR{$tskid}}{"ER_UINT"} = "ercd"; |
|---|
| 119 | |
|---|
| 120 | push(@{$TASKCODE{$tskid}{$tskcnt}}, sprintf("\tercd = %s;", $svc_call)); |
|---|
| 121 | gen_var_def($svc_call); |
|---|
| 122 | |
|---|
| 123 | if ($error_code_string eq "") { |
|---|
| 124 | push(@{$TASKCODE{$tskid}{$tskcnt}}, |
|---|
| 125 | sprintf("\tcheck_ercd(ercd, E_OK);"), ""); |
|---|
| 126 | } |
|---|
| 127 | elsif ($error_code_string =~ /^\-\>\s*noreturn$/) { |
|---|
| 128 | push(@{$TASKCODE{$tskid}{$tskcnt}}, ""); |
|---|
| 129 | } |
|---|
| 130 | else { |
|---|
| 131 | $error_code = $error_code_string; |
|---|
| 132 | $error_code =~ s/^\-\>\s*([A-Za-z0-9_]*)$/$1/; |
|---|
| 133 | push(@{$TASKCODE{$tskid}{$tskcnt}}, |
|---|
| 134 | sprintf("\tcheck_ercd(ercd, %s);", $error_code), ""); |
|---|
| 135 | } |
|---|
| 136 | } |
|---|
| 137 | |
|---|
| 138 | sub parse_line { |
|---|
| 139 | local($line) = @_; |
|---|
| 140 | |
|---|
| 141 | while ($line =~ s/\\$//) { |
|---|
| 142 | $line1 = <INFILE>; |
|---|
| 143 | $output_line .= $line1; |
|---|
| 144 | chomp $line1; |
|---|
| 145 | $line1 =~ s/^\s*\*\s*//; |
|---|
| 146 | $line1 =~ s/\s*\/\/.*$//; |
|---|
| 147 | $line1 =~ s/\s*\.\.\..*$//; |
|---|
| 148 | $line .= $line1; |
|---|
| 149 | } |
|---|
| 150 | |
|---|
| 151 | if ($line =~ /^\.\./) { |
|---|
| 152 | # do nothing. |
|---|
| 153 | } |
|---|
| 154 | elsif ($line =~ /^==\s*((TASK|ALM|CPUEXC|EXTSVC)[0-9]*)(.*)$/) { |
|---|
| 155 | $procflag = 1; |
|---|
| 156 | $tskid = $1; |
|---|
| 157 | $line2 = $3; |
|---|
| 158 | if ($line2 =~ /^\-TEX(.*)$/) { |
|---|
| 159 | $tskid = $tskid."-TEX"; |
|---|
| 160 | $line2 = $1; |
|---|
| 161 | } |
|---|
| 162 | if ($line2 =~ /^\-([0-9]+)(.*)$/) { |
|---|
| 163 | $tskcnt = $1; |
|---|
| 164 | if (!$TASKCOUNTVAR{$tskid}) { |
|---|
| 165 | if ($tskid =~ /^TASK([0-9]*)$/) { |
|---|
| 166 | $countvar = "task$1_count"; |
|---|
| 167 | } |
|---|
| 168 | elsif ($tskid =~ /^TASK([0-9]*)-TEX$/) { |
|---|
| 169 | $countvar = "tex_task$1_count"; |
|---|
| 170 | } |
|---|
| 171 | elsif ($tskid =~ /^ALM([0-9]*)$/) { |
|---|
| 172 | $countvar = "alarm$1_count"; |
|---|
| 173 | } |
|---|
| 174 | elsif ($tskid =~ /^CPUEXC([0-9]*)$/) { |
|---|
| 175 | $countvar = "cpuexc$1_count"; |
|---|
| 176 | } |
|---|
| 177 | elsif ($tskid =~ /^EXTSVC([0-9]*)$/) { |
|---|
| 178 | $countvar = "extsvc$1_count"; |
|---|
| 179 | } |
|---|
| 180 | $TASKCOUNTVAR{$tskid} = $countvar; |
|---|
| 181 | } |
|---|
| 182 | } |
|---|
| 183 | else { |
|---|
| 184 | $tskcnt = ""; |
|---|
| 185 | } |
|---|
| 186 | if ($startflag) { |
|---|
| 187 | push(@{$TASKCODE{$tskid}{$tskcnt}}, "\ttest_start(__FILE__);"); |
|---|
| 188 | push(@{$TASKCODE{$tskid}{$tskcnt}}, ""); |
|---|
| 189 | $startflag = 0; |
|---|
| 190 | } |
|---|
| 191 | } |
|---|
| 192 | elsif (!$procflag) { |
|---|
| 193 | # do nothing. |
|---|
| 194 | } |
|---|
| 195 | elsif ($line =~ /^([0-9]+\:)\s*END$/) { |
|---|
| 196 | $check_str = $1; |
|---|
| 197 | $check_no = ++$last_check_point; |
|---|
| 198 | push(@{$TASKCODE{$tskid}{$tskcnt}}, |
|---|
| 199 | sprintf("\tcheck_finish(%d);", $check_no)); |
|---|
| 200 | $procflag = 0; |
|---|
| 201 | $output_line =~ s/$check_str/$check_no:/; |
|---|
| 202 | } |
|---|
| 203 | else { |
|---|
| 204 | if ($line =~ /^([0-9]+\:)\s*(.*)/) { |
|---|
| 205 | $check_str = $1; |
|---|
| 206 | $line = $2; |
|---|
| 207 | $check_no = ++$last_check_point; |
|---|
| 208 | push(@{$TASKCODE{$tskid}{$tskcnt}}, |
|---|
| 209 | sprintf("\tcheck_point(%d);", $check_no)); |
|---|
| 210 | $output_line =~ s/$check_str/$check_no:/; |
|---|
| 211 | } |
|---|
| 212 | if ($line =~ /^(assert\(.*\))$/) { |
|---|
| 213 | $assert_string = $1; |
|---|
| 214 | push(@{$TASKCODE{$tskid}{$tskcnt}}, |
|---|
| 215 | sprintf("\tcheck_%s;", $assert_string), ""); |
|---|
| 216 | } |
|---|
| 217 | elsif ($line =~ /^(state(_i)?\(.*\))$/) { |
|---|
| 218 | $state_string = $1; |
|---|
| 219 | push(@{$TASKCODE{$tskid}{$tskcnt}}, |
|---|
| 220 | sprintf("\tcheck_%s;", $state_string), ""); |
|---|
| 221 | } |
|---|
| 222 | elsif ($line =~ /^call\((.*)\)$/ || $line =~ /^DO\((.*)\)$/) { |
|---|
| 223 | $call_string = $1; |
|---|
| 224 | push(@{$TASKCODE{$tskid}{$tskcnt}}, |
|---|
| 225 | sprintf("\t%s;", $call_string), ""); |
|---|
| 226 | } |
|---|
| 227 | elsif ($line =~ /^MISSING$/) { |
|---|
| 228 | push(@{$TASKCODE{$tskid}{$tskcnt}}, ""); |
|---|
| 229 | } |
|---|
| 230 | elsif ($line =~ /^RETURN((\(.*\))?)$/) { |
|---|
| 231 | $return_string = $1; |
|---|
| 232 | push(@{$TASKCODE{$tskid}{$tskcnt}}, |
|---|
| 233 | "\treturn".$return_string.";", ""); |
|---|
| 234 | } |
|---|
| 235 | elsif ($line =~ /^GOTO\((.*)\)$/) { |
|---|
| 236 | $goto_string = $1; |
|---|
| 237 | push(@{$TASKCODE{$tskid}{$tskcnt}}, |
|---|
| 238 | sprintf("\tgoto %s;", $goto_string), ""); |
|---|
| 239 | } |
|---|
| 240 | elsif ($line =~ /^LABEL\((.*)\)$/) { |
|---|
| 241 | $label_string = $1; |
|---|
| 242 | $indent_string = $indentstr; |
|---|
| 243 | $indent_string =~ s/\t$//; |
|---|
| 244 | push(@{$TASKCODE{$tskid}{$tskcnt}}, |
|---|
| 245 | sprintf("%s:", $label_string)); |
|---|
| 246 | } |
|---|
| 247 | elsif ($line =~ /^([a-z_]+\(.*\))\s*(\-\>\s*[A-Za-z0-9_]*)?\s*$/) { |
|---|
| 248 | $svc_call = $1; |
|---|
| 249 | $error_code_string = $2; |
|---|
| 250 | gen_svc_call($svc_call, $error_code_string); |
|---|
| 251 | } |
|---|
| 252 | else { |
|---|
| 253 | print STDERR "Error: ",$line,"\n"; |
|---|
| 254 | } |
|---|
| 255 | } |
|---|
| 256 | } |
|---|
| 257 | |
|---|
| 258 | # |
|---|
| 259 | # ¥¹¥¯¥ê¥×¥È¥Õ¥¡¥€¥ëÆÉ¹þ€ßœèÍý |
|---|
| 260 | # |
|---|
| 261 | $procflag = 0; |
|---|
| 262 | $startflag = 1; |
|---|
| 263 | $outflag = 1; |
|---|
| 264 | open(INFILE, $infile) || die "Cannot open $infile"; |
|---|
| 265 | while (($line = <INFILE>) && $outflag) { |
|---|
| 266 | $output_line = $line; |
|---|
| 267 | chomp $line; |
|---|
| 268 | $line =~ s/^\s*\*\s*//; |
|---|
| 269 | $line =~ s/\s*\/\/.*$//; |
|---|
| 270 | $line =~ s/\s*\.\.\..*$//; |
|---|
| 271 | if ($line) { |
|---|
| 272 | parse_line($line); |
|---|
| 273 | } |
|---|
| 274 | print $output_line; |
|---|
| 275 | if ($output_line =~ /DO NOT DELETE THIS LINE/) { |
|---|
| 276 | $outflag = 0; |
|---|
| 277 | } |
|---|
| 278 | } |
|---|
| 279 | close(INFILE); |
|---|
| 280 | |
|---|
| 281 | # |
|---|
| 282 | # ¥¿¥¹¥¯€ÎÊÑ¿ôÄêµÁ€Î¥³¡Œ¥ÉœÐÎÏ |
|---|
| 283 | # |
|---|
| 284 | sub output_task_vardef { |
|---|
| 285 | my($tskid) = @_; |
|---|
| 286 | |
|---|
| 287 | foreach my $typename (keys(%{$TASKVAR{$tskid}})) { |
|---|
| 288 | print "\t",$typename, (length($typename) < 4 ? "\t\t" : "\t"), |
|---|
| 289 | ${$TASKVAR{$tskid}}{$typename},";\n"; |
|---|
| 290 | } |
|---|
| 291 | } |
|---|
| 292 | |
|---|
| 293 | # |
|---|
| 294 | # ¥¿¥¹¥¯ËÜÂ΀Υ³¡Œ¥ÉœÐÎÏ |
|---|
| 295 | # |
|---|
| 296 | sub output_task_body { |
|---|
| 297 | my($tskid) = @_; |
|---|
| 298 | |
|---|
| 299 | foreach my $tskcnt (sort {$a <=> $b} (keys(%{$TASKCODE{$tskid}}))) { |
|---|
| 300 | printf "\tcase %d:\n", $tskcnt; |
|---|
| 301 | foreach my $line (@{$TASKCODE{$tskid}{$tskcnt}}) { |
|---|
| 302 | print "\t",$line if ($line); |
|---|
| 303 | print "\n"; |
|---|
| 304 | } |
|---|
| 305 | printf "\t\tcheck_point(0);\n\n"; |
|---|
| 306 | } |
|---|
| 307 | } |
|---|
| 308 | |
|---|
| 309 | # |
|---|
| 310 | # ¥¿¥¹¥¯¥³¡Œ¥É€ÎœÐÎÏ |
|---|
| 311 | # |
|---|
| 312 | sub output_task { |
|---|
| 313 | if ($TASKCOUNTVAR{$tskid}) { |
|---|
| 314 | printf "\nstatic uint_t\t%s = 0;\n", $TASKCOUNTVAR{$tskid}; |
|---|
| 315 | } |
|---|
| 316 | if ($tskid =~ /^TASK([0-9]*)$/) { |
|---|
| 317 | print "\nvoid\n"; |
|---|
| 318 | print "task$1(intptr_t exinf)\n"; |
|---|
| 319 | } |
|---|
| 320 | elsif ($tskid =~ /^TASK([0-9]*)-TEX$/) { |
|---|
| 321 | print "\nvoid\n"; |
|---|
| 322 | print "tex_task$1(TEXPTN texptn, intptr_t exinf)\n"; |
|---|
| 323 | } |
|---|
| 324 | elsif ($tskid =~ /^ALM([0-9]*)$/) { |
|---|
| 325 | print "\nvoid\n"; |
|---|
| 326 | print "alarm$1_handler(intptr_t exinf)\n"; |
|---|
| 327 | } |
|---|
| 328 | elsif ($tskid =~ /^CPUEXC([0-9]*)$/) { |
|---|
| 329 | print "\nvoid\n"; |
|---|
| 330 | print "cpuexc$1_handler(void *p_excinf)\n"; |
|---|
| 331 | } |
|---|
| 332 | elsif ($tskid =~ /^EXTSVC([0-9]*)$/) { |
|---|
| 333 | print "\nER_UINT\n"; |
|---|
| 334 | print "extsvc$1_routine(intptr_t par1, intptr_t par2, intptr_t par3,\n"; |
|---|
| 335 | print "\t\t\t\t\t\t\t\tintptr_t par4, intptr_t par5, ID cdmid)\n"; |
|---|
| 336 | } |
|---|
| 337 | print "{\n"; |
|---|
| 338 | output_task_vardef($tskid); |
|---|
| 339 | print "\n"; |
|---|
| 340 | if ($TASKCOUNTVAR{$tskid}) { |
|---|
| 341 | printf "\tswitch (++%s) {\n", $TASKCOUNTVAR{$tskid}; |
|---|
| 342 | output_task_body($tskid); |
|---|
| 343 | printf "\tdefault:\n"; |
|---|
| 344 | printf "\t\tcheck_point(0);\n"; |
|---|
| 345 | printf "\t}\n"; |
|---|
| 346 | } |
|---|
| 347 | else { |
|---|
| 348 | foreach my $line (@{$TASKCODE{$tskid}{""}}) { |
|---|
| 349 | print $line,"\n"; |
|---|
| 350 | } |
|---|
| 351 | } |
|---|
| 352 | print "\tcheck_point(0);\n"; |
|---|
| 353 | if ($tskid =~ /^EXTSVC([0-9]*)$/) { |
|---|
| 354 | print "\treturn(E_SYS);\n"; |
|---|
| 355 | } |
|---|
| 356 | print "}\n"; |
|---|
| 357 | } |
|---|
| 358 | |
|---|
| 359 | # |
|---|
| 360 | # ¥Æ¥¹¥È¥×¥í¥°¥é¥àœÐÎÏœèÍý |
|---|
| 361 | # |
|---|
| 362 | foreach $tskid (sort(keys(%TASKCODE))) { |
|---|
| 363 | output_task(); |
|---|
| 364 | } |
|---|