1 #!/usr/local/bin/perl -w
3 # Create link and execute definitions for switch-basic dispatch method.
4 # Copyright (c) 1998 New Generation Software (NGS) Oy
6 # Author: Markku Rossi <mtr@ngs.fi>
10 # This library is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU Library General Public
12 # License as published by the Free Software Foundation; either
13 # version 2 of the License, or (at your option) any later version.
15 # This library is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 # Library General Public License for more details.
20 # You should have received a copy of the GNU Library General Public
21 # License along with this library; if not, write to the Free
22 # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
27 # $Source: /cygdrive/c/RCVS/CVS/ReactOS/reactos/lib/kjs/src/make-swt0.pl,v $
35 $target = "./c1swt0.h";
36 open(CFP
, ">$target") || die "couldn't create `$target': $!\n";
38 $target = "./eswt0.h";
39 open(EFP
, ">$target") || die "couldn't create `$target': $!\n";
42 if (/operand\s+([a-zA-Z_][a-zA-Z0-9_]+)\s+([\S]+)\s+\{(.*)/) {
48 if ($flags =~ /symbol/) {
52 if ($flags =~ /jump/) {
57 printf CFP
("#line %d \"%s\"\n", $. - 1, $ARGV);
59 print CFP
"/* operand $operand ($opcount) */\n";
60 print CFP
"case $opcount:\n";
61 if ($operand eq "const") {
62 # Patch const offsets.
63 printf CFP
" JS_BC_READ_INT32 (cp, i);\n";
64 printf CFP
" i += consts_offset;\n";
65 printf CFP
" JS_BC_WRITE_INT32 (cp, i);\n";
68 printf CFP
" JS_BC_READ_INT32 (cp, i);\n";
69 printf CFP
" i += consts_offset;\n";
70 printf CFP
" i = vm->consts[i].u.vsymbol;\n";
71 printf CFP
" JS_BC_WRITE_INT32 (cp, i);\n";
73 print CFP
" cp += $args;\n";
74 print CFP
" break;\n\n";
80 printf EFP
"#line %d\"%s\"\n", $. - 1, $ARGV;
82 print EFP
"/* operand $operand ($opcount) */\n";
83 print EFP
"case $opcount:\n";
86 print EFP
" break;\n\n";