[ruby-list:46533] Re: CLUのコンパイラ clu2c
From:
とうへいひろふみ <hirofumitouhei@...>
Date:
2009-11-09 16:51:08 UTC
List:
ruby-list #46533
東平と申します。
2009年11月7日17:00 とうへいひろふみ <hirofumitouhei@gmail.com>:
> 少し手を加え、セルフコンパイル可能であることも確認しました。
ここがきちんと動作しておりませんでした。
念のため、下記のパッチを当てて作りなおしてください。
改造個所は bin/clu2c/genv.clu (と bin/clu2c/pretrans/genv.c)です。
なお、暫定的に <http://touhei.hp.infoseek.co.jp/clu2c/> を整備しましたので、
以後、更新時はそちらのページに載せます。
お騒がせしてすいませんでした。
それでは、失礼いたします。
東平洋史
---8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<---
diff -urN ./clu2c-1.99.3-7/bin/clu2c/genv.clu
./clu2c-1.99.3-8/bin/clu2c/genv.clu
--- ./clu2c-1.99.3-7/bin/clu2c/genv.clu 2009-11-09 22:40:58.257000000 +0900
+++ ./clu2c-1.99.3-8/bin/clu2c/genv.clu 2009-11-09 21:12:42.817000000 +0900
@@ -656,7 +656,7 @@
func: funcinfo := down(co).func
% put function name and list of arguments.
- header: str := "object " || func.name || "("
+ header: str := "int " || func.name || "("
args: farglist := func.args
begin
header := header || args[1].idn
diff -urN ./clu2c-1.99.3-7/bin/clu2c/pretrans/genv.c
./clu2c-1.99.3-8/bin/clu2c/pretrans/genv.c
--- ./clu2c-1.99.3-7/bin/clu2c/pretrans/genv.c 2009-11-09
22:40:58.823000000 +0900
+++ ./clu2c-1.99.3-8/bin/clu2c/pretrans/genv.c 2009-11-09
22:52:17.051000000 +0900
@@ -40,7 +40,7 @@
static STRING_REP(13) str7 = {13, {'w', 'r', 'o', 'n', 'g', '_', 'v',
'e', 'r', 's', 'i', 'o', 'n'}};
static STRING_REP(6) str8 = {6, {'e', 'x', 't', 'e', 'r', 'n'}};
static STRING_REP(6) str9 = {6, {'s', 't', 'a', 't', 'i', 'c'}};
-static STRING_REP(7) str10 = {7, {'o', 'b', 'j', 'e', 'c', 't', ' '}};
+static STRING_REP(4) str10 = {4, {'i', 'n', 't', ' '}};
static STRING_REP(1) str11 = {1, {'('}};
static STRING_REP(2) str12 = {2, {',', ' '}};
static STRING_REP(1) str13 = {1, {')'}};
@@ -104,9 +104,10 @@
static STRING_REP(14) str71 = {14, {'n', 'o', 't', '_', 'd', 'e',
'b', 'u', 'g', '_', 'm', 'o', 'd', 'e'}};
static STRING_REP(7) str72 = {7, {'s', 't', 'a', 't', 'i', 'c', ' '}};
static STRING_REP(4) str73 = {4, {'=', ' ', '0', ';'}};
-static STRING_REP(7) str74 = {7, {'I', 'N', 'V', '_', 'T', 'O', 'P'}};
-static STRING_REP(9) str75 = {9, {'W', 'O', 'R', 'K', '_', 'S', 'I',
'Z', 'E'}};
-static STRING_REP(7) str76 = {7, {'u', 'n', 'k', 'n', 'o', 'w', 'n'}};
+static STRING_REP(7) str74 = {7, {'o', 'b', 'j', 'e', 'c', 't', ' '}};
+static STRING_REP(7) str75 = {7, {'I', 'N', 'V', '_', 'T', 'O', 'P'}};
+static STRING_REP(9) str76 = {9, {'W', 'O', 'R', 'K', '_', 'S', 'I',
'Z', 'E'}};
+static STRING_REP(7) str77 = {7, {'u', 'n', 'k', 'n', 'o', 'w', 'n'}};
/* begin module */
/* c_function_name, OFg__env_Dcreate */
@@ -3534,7 +3535,7 @@
LVco = retval_area[0];
LVmax = OMrecord_Dget(2, OMrecord_Dget(4, WVr_IN_Clv));
LVi = 1;
- LVd = ((string) &str10);
+ LVd = ((string) &str74);
while (TRUE)
{
if (!OMint_Dle(LVi, LVmax))
@@ -3581,13 +3582,13 @@
{
goto except0;
}
- LVd = ((string) &str10);
+ LVd = ((string) &str74);
}
LVi = OMint_Dadd(LVi, 1);
}
}
t1 = OMstring_Dsize(LVd);
- if (OMint_Dgt(t1, OMstring_Dsize(((string) &str10))))
+ if (OMint_Dgt(t1, OMstring_Dsize(((string) &str74))))
{
t2 = OMstring_Dsize(LVd)
+ OMstring_Dsize(((string) &str16));
@@ -3637,7 +3638,7 @@
(*ivarp)[INV_TOP+0] = OMarray_Dsize(OMrecord_Dget(1, WVr_IN_Clv));
(*ivarp)[1] = OMint_Dadd(OMint_Dadd((*ivarp)[INV_TOP+0],
OMrecord_Dget(1, OMrecord_Dget(2, WVr_IN_Clv))), 1);
OFint_Dunparse((*ivarp)[1]);
- (*ivarp)[INV_TOP+0] = ((string) &str74);
+ (*ivarp)[INV_TOP+0] = ((string) &str75);
(*ivarp)[INV_TOP+1] = retval_area[0];
retval_area[0] = (*ivarp)[INV_TOP+0];
retval_area[1] = (*ivarp)[INV_TOP+1];
@@ -3646,7 +3647,7 @@
yield1:
NO_OPERATION;
OFint_Dunparse(OMint_Dadd((*ivarp)[1], OMrecord_Dget(2,
OMrecord_Dget(4, WVr_IN_Clv))));
- (*ivarp)[INV_TOP+0] = ((string) &str75);
+ (*ivarp)[INV_TOP+0] = ((string) &str76);
(*ivarp)[INV_TOP+1] = retval_area[0];
retval_area[0] = (*ivarp)[INV_TOP+0];
retval_area[1] = (*ivarp)[INV_TOP+1];
@@ -3830,7 +3831,7 @@
goto except0;
}
}
- signame = ((string) &str76);
+ signame = ((string) &str77);
return(SIG);
/* end body */
noretval(SLNULL);